]> git.ipfire.org Git - nitsi.git/commitdiff
Supporting the a single statement in a recipe
authorJonatan Schlag <jonatan.schlag@ipfire.org>
Wed, 6 Jun 2018 14:32:05 +0000 (16:32 +0200)
committerJonatan Schlag <jonatan.schlag@ipfire.org>
Wed, 6 Jun 2018 14:32:05 +0000 (16:32 +0200)
We now can use the all statement without any other statements.

Signed-off-by: Jonatan Schlag <jonatan.schlag@ipfire.org>
src/nitsi/recipe.py
src/nitsi/test.py

index 7d27ca4fd41d82d99a2152084beb939898e10e37..f76066a96e1b2638727c1a8f2028780a058de58e 100644 (file)
@@ -16,7 +16,7 @@ class RecipeExeption(Exception):
 # Should read the test, check if the syntax are valid
 # and return tuples with the ( host, command ) structure
 class recipe():
-    def __init__(self, path, circle=[]):
+    def __init__(self, path, circle=[], machines=[]):
         self.recipe_file = path
         try:
             self.path = os.path.dirname(self.recipe_file)
@@ -28,7 +28,9 @@ class recipe():
         self.log = logger.getChild(self.name)
         self.log.debug("Path of recipe is: {}".format(self.recipe_file))
         self._recipe = None
-        self._machines = None
+        self._machines = machines
+
+        self.log.debug("Machine names we use when we substitute the all statement: {}".format(self._machines))
 
         self.in_recursion = True
         if len(circle) == 0:
@@ -57,12 +59,6 @@ class recipe():
 
     @property
     def machines(self):
-        if not self._machines:
-            self._machines = []
-            for line in self._recipe:
-                if line[0] != "all" and line[0] not in self._machines:
-                    self._machines.append(line[0])
-
         return self._machines
 
     def parse(self):
index e1ae24cbd3cab719db7ffab0c3eceac06f790d2e..a861a48eaf3c37a481ffeba77e2d99f1a1a2665d 100755 (executable)
@@ -103,7 +103,7 @@ class test():
     def load_recipe(self):
         self.log.info("Going to load the recipe")
         try:
-            self.recipe = recipe.recipe(self.recipe_file)
+            self.recipe = recipe.recipe(self.recipe_file, machines=self.virtual_environ.machine_names)
             for line in self.recipe.recipe:
                 self.log.debug(line)