[prev in list] [next in list] [prev in thread] [next in thread] 

List:       lnst-developers
Subject:    [PATCH 2/5] RecipeParser: add support for PyRecipes
From:       Jiri Prochazka <jprochaz () redhat ! com>
Date:       2016-01-16 17:50:31
Message-ID: 1452966634-25908-3-git-send-email-jprochaz () redhat ! com
[Download RAW message or body]

For PyRecipe network definition, the syntax is the same as it was
for Python tasks, eg. when network is defined in file network.py,
network tag in XML recipe will look like this:
<network python="network.py" />

RecipeParser will check if network is defined with python attribute,
and returns path to the file in recipe["network"] variable.

Signed-off-by: Jiri Prochazka <jprochaz@redhat.com>
---
 lnst/Controller/RecipeParser.py | 12 ++++++++----
 1 file changed, 8 insertions(+), 4 deletions(-)

diff --git a/lnst/Controller/RecipeParser.py b/lnst/Controller/RecipeParser.py
index 827279f..d1a9e74 100644
--- a/lnst/Controller/RecipeParser.py
+++ b/lnst/Controller/RecipeParser.py
@@ -29,10 +29,14 @@ class RecipeParser(XmlParser):
 
         # machines
         machines_tag = lnst_recipe.find("network")
-        if machines_tag is not None:
-            machines = recipe["machines"] = XmlCollection(machines_tag)
-            for machine_tag in machines_tag:
-                machines.append(self._process_machine(machine_tag))
+
+        if self._has_attribute(machines_tag, "python"):
+            recipe["network"] = self._get_attribute(machines_tag, "python")
+        else:
+            if machines_tag is not None:
+                machines = recipe["machines"] = XmlCollection(machines_tag)
+                for machine_tag in machines_tag:
+                    machines.append(self._process_machine(machine_tag))
 
         # tasks
         tasks = recipe["tasks"] = XmlCollection()
-- 
2.4.3
_______________________________________________
LNST-developers mailing list
lnst-developers@lists.fedorahosted.org
https://lists.fedorahosted.org/admin/lists/lnst-developers@lists.fedorahosted.org

[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic