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
wrong patch file, sorry for that, correct one sent again
-- Jiri Prochazka LNST developer (www.lnst-project.org) Red Hat Czech s.r.o.
----- Original Message ----- From: "Jiri Prochazka" jprochaz@redhat.com To: lnst-developers@lists.fedorahosted.org Sent: Thursday, June 25, 2015 3:24:36 PM Subject: [PATCH] Fix issue 124
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
lnst-developers@lists.fedorahosted.org