Make paths absolut when we know that we get valid paths to a file or a dir
authorJonatan Schlag <jonatan.schlag@ipfire.org>
Sat, 8 Sep 2018 11:03:18 +0000 (13:03 +0200)
committerJonatan Schlag <jonatan.schlag@ipfire.org>
Sat, 8 Sep 2018 11:03:18 +0000 (13:03 +0200)
Signed-off-by: Jonatan Schlag <jonatan.schlag@ipfire.org>
src/nitsi/test.py

index dd61038..38e7afa 100755 (executable)
@@ -60,17 +60,6 @@ class Test():
             self.recipe_file = "{}/recipe".format(self.path)
             self.settings_file = "{}/settings".format(self.path)
 
-        if recipe_file:
-            if not os.path.isabs(recipe_file):
-                self.recipe_file = os.path.abspath(recipe_file)
-            else:
-                self.recipe_file = recipe_file
-
-        if settings_file:
-            if not os.path.isabs(settings_file):
-                self.settings_file = os.path.abspath(settings_file)
-            else:
-                self.settings_file = settings_file
 
         # We can also go on without a settings file
         if self.settings_file:
@@ -87,6 +76,18 @@ class Test():
             logger.error("No such file: {}".format(self.recipe_file))
             raise TestException("No recipe file found")
 
+        if recipe_file:
+            if not os.path.isabs(recipe_file):
+                self.recipe_file = os.path.abspath(recipe_file)
+            else:
+                self.recipe_file = recipe_file
+
+        if settings_file:
+            if not os.path.isabs(settings_file):
+                self.settings_file = os.path.abspath(settings_file)
+            else:
+                self.settings_file = settings_file
+
 
         # Init logging
         if dir: