]> git.ipfire.org Git - nitsi.git/commitdiff
Fix check if we get an valid recipe file
authorJonatan Schlag <jonatan.schlag@ipfire.org>
Sat, 23 Jun 2018 07:59:39 +0000 (09:59 +0200)
committerJonatan Schlag <jonatan.schlag@ipfire.org>
Sat, 23 Jun 2018 07:59:39 +0000 (09:59 +0200)
Signed-off-by: Jonatan Schlag <jonatan.schlag@ipfire.org>
src/nitsi/test.py

index 3ee793637223ac4793302a8986cdfb67a46816eb..b9ea034c2c284e6dcba84168c6220d115d31c9e8 100755 (executable)
@@ -76,13 +76,14 @@ class Test():
                 logger.error("No such file: {}".format(self.settings_file))
                 raise TestException("No settings file found")
 
-        # os.path.isfile fails if self.recipe_file is None so we need to catch exceptions here
-        try:
-            if not (self.recipe_file or os.path.isfile(self.recipe_file)):
+        # os.path.isfile fails if self.recipe_file is None so we cannot use an and statement
+        if self.recipe_file:
+            if not os.path.isfile(self.recipe_file):
                 logger.error("No such file: {}".format(self.recipe_file))
                 raise TestException("No recipe file found")
-        except BaseException:
-            pass
+        else:
+            logger.error("No such file: {}".format(self.recipe_file))
+            raise TestException("No recipe file found")
 
 
         # Init logging