From bce7d5203e01fa4c17a35632473f3adc6aa7efbe Mon Sep 17 00:00:00 2001 From: Jonatan Schlag Date: Sat, 21 Apr 2018 13:24:32 +0200 Subject: [PATCH] Correctly handle exit codes Signed-off-by: Jonatan Schlag --- test.py | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/test.py b/test.py index d5be079..634bf5b 100755 --- 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: -- 2.39.2