This patch fixes possibility to define interfaces with non-unique IDs per machine.
Signed-off-by: Jiri Prochazka jprochaz@redhat.com --- lnst/Controller/RecipeParser.py | 9 +++++++++ 1 file changed, 9 insertions(+)
diff --git a/lnst/Controller/RecipeParser.py b/lnst/Controller/RecipeParser.py index 73422f1..936a870 100644 --- a/lnst/Controller/RecipeParser.py +++ b/lnst/Controller/RecipeParser.py @@ -66,10 +66,18 @@ class RecipeParser(XmlParser): machine["interfaces"] = XmlCollection(interfaces_tag)
lo_netns = [] + unique_ids = [] for interface_tag in interfaces_tag: interfaces = self._process_interface(interface_tag)
for interface in interfaces: + if interface['id'] in unique_ids: + msg = "Interface with ID "%s" has already been "\ + "defined for this machine." % interface['id'] + raise RecipeError(msg, interface_tag) + else: + unique_ids.append(interface['id']) + if interface['type'] != 'lo': continue elif interface['netns'] in lo_netns: @@ -77,6 +85,7 @@ class RecipeParser(XmlParser): raise RecipeError(msg, interface_tag) else: lo_netns.append(interface['netns']) + machine["interfaces"].extend(interfaces)
return machine
Mon, Jun 29, 2015 at 08:20:12AM CEST, jprochaz@redhat.com wrote:
This patch fixes possibility to define interfaces with non-unique IDs per machine.
Signed-off-by: Jiri Prochazka jprochaz@redhat.com
lnst/Controller/RecipeParser.py | 9 +++++++++ 1 file changed, 9 insertions(+)
diff --git a/lnst/Controller/RecipeParser.py b/lnst/Controller/RecipeParser.py index 73422f1..936a870 100644 --- a/lnst/Controller/RecipeParser.py +++ b/lnst/Controller/RecipeParser.py @@ -66,10 +66,18 @@ class RecipeParser(XmlParser): machine["interfaces"] = XmlCollection(interfaces_tag)
lo_netns = []
unique_ids = [] for interface_tag in interfaces_tag: interfaces = self._process_interface(interface_tag) for interface in interfaces:
if interface['id'] in unique_ids:
msg = "Interface with ID \"%s\" has already been "\
"defined for this machine." % interface['id']
raise RecipeError(msg, interface_tag)
else:
unique_ids.append(interface['id'])
if interface['type'] != 'lo': continue elif interface['netns'] in lo_netns:
@@ -77,6 +85,7 @@ class RecipeParser(XmlParser): raise RecipeError(msg, interface_tag) else: lo_netns.append(interface['netns'])
machine["interfaces"].extend(interfaces) return machine
-- 2.4.3
LNST-developers mailing list LNST-developers@lists.fedorahosted.org https://lists.fedorahosted.org/mailman/listinfo/lnst-developers
Acked-by: Jan Tluka jtluka@redhat.com
On Mon, Jun 29, 2015 at 08:20:12AM +0200, Jiri Prochazka wrote:
This patch fixes possibility to define interfaces with non-unique IDs per machine.
Signed-off-by: Jiri Prochazka jprochaz@redhat.com
Acked-by: Ondrej Lichtner olichtne@redhat.com
Mon, Jun 29, 2015 at 08:20:12AM CEST, jprochaz@redhat.com wrote:
This patch fixes possibility to define interfaces with non-unique IDs per machine.
Signed-off-by: Jiri Prochazka jprochaz@redhat.com
applied, thanks.
lnst-developers@lists.fedorahosted.org