[PATCH] Fix issue 124

Jiri Prochazka jprochaz at redhat.com
Thu Jun 25 13:26:13 UTC 2015


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 at redhat.com>
To: lnst-developers at lists.fedorahosted.org
Sent: Thursday, June 25, 2015 3:24:36 PM
Subject: [PATCH] Fix issue 124

Signed-off-by: Jiri Prochazka <jprochaz at 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 at lists.fedorahosted.org
https://lists.fedorahosted.org/mailman/listinfo/lnst-developers


More information about the LNST-developers mailing list