Correctly handle exit codes
authorJonatan Schlag <jonatan.schlag@ipfire.org>
Sat, 21 Apr 2018 11:24:32 +0000 (13:24 +0200)
committerJonatan Schlag <jonatan.schlag@ipfire.org>
Sat, 21 Apr 2018 11:24:32 +0000 (13:24 +0200)
Signed-off-by: Jonatan Schlag <jonatan.schlag@ipfire.org>
test.py

diff --git a/test.py b/test.py
index d5be079..634bf5b 100755 (executable)
--- a/test.py
+++ b/test.py
@@ -515,12 +515,15 @@ class test():
     def run_recipe(self):
         for line in self.recipe.recipe:
             return_value = self.virtual_machines[line[0]].cmd(line[2])
-            if not return_value and line[1] == "":
-                self.log.error("Failed to execute command '{}' on {}".format(line[2],line[0]))
+            self.log.debug("Return value is: {}".format(return_value))
+            if return_value != "0" and line[1] == "":
+                self.log.error("Failed to execute command '{}' on {}, return code: {}".format(line[2],line[0], return_value))
                 return False
-            elif return_value == True and line[1] == "!":
-                self.log.error("Succeded to execute command '{}' on {}".format(line[2],line[0]))
+            elif return_value == "0" and line[1] == "!":
+                self.log.error("Succeded to execute command '{}' on {}, return code: {}".format(line[2],line[0],return_value))
                 return False
+            else:
+                self.log.debug("Command '{}' on {} returned with: {}".format(line[2],line[0],return_value))
 
     def virtual_environ_stop(self):
         for name in self.virtual_environ.machine_names: