Split setup virtual environment in two functions
authorJonatan Schlag <jonatan.schlag@ipfire.org>
Sat, 28 Jul 2018 09:44:54 +0000 (11:44 +0200)
committerJonatan Schlag <jonatan.schlag@ipfire.org>
Sat, 28 Jul 2018 09:44:54 +0000 (11:44 +0200)
We need the list of virtual machines in the virtual environment to parse
the recipe, but we can create the list of used machines only when we
have a recipe. So we need to split these function.

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

index c9d3d0f..12bff89 100755 (executable)
--- a/nitsi.in
+++ b/nitsi.in
@@ -101,8 +101,9 @@ def main():
                 settings_file=args.settings,
                 cmd_settings=settings)
             currenttest.read_settings()
+            currenttest.virtual_environ_setup_stage_1()
             currenttest.load_recipe()
-            currenttest.virtual_environ_setup()
+            currenttest.virtual_environ_setup_stage_2()
         except RecipeExeption as e:
             logger.exception(e)
             return 2
index 51c6402..7d17cec 100755 (executable)
@@ -137,13 +137,14 @@ class Test():
             self.log.debug("{}: {}".format(key, self.settings[key]))
 
 
-    def virtual_environ_setup(self):
+    def virtual_environ_setup_stage_1(self):
         self.virtual_environ = virtual_environ.VirtualEnviron(self.settings["virtual_environ_path"])
 
         self.virtual_networks = self.virtual_environ.get_networks()
 
         self.virtual_machines = self.virtual_environ.get_machines()
 
+    def virtual_environ_setup_stage_2(self):
         # built up which machines which are used in our recipe
         used_machines = []