From a389849c5b827fa5aac8ff93a1241c642cd300e6 Mon Sep 17 00:00:00 2001 From: Sander Vrijders Date: Wed, 30 May 2018 16:21:08 +0200 Subject: executors: Make local executor more robust This improves the behavior of the local executor. It will now stop when a command fails and will return the output of an executed command. --- rumba/executors/local.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/rumba/executors/local.py b/rumba/executors/local.py index d0ebc56..cab626d 100644 --- a/rumba/executors/local.py +++ b/rumba/executors/local.py @@ -41,7 +41,10 @@ class LocalExecutor(mod.Executor): def execute_command(self, node, cmd, sudo=False, time_out=3): try: logger.debug("%s >> %s" % (node.name, cmd)) - subprocess.check_call(cmd.split(' ')) + output = subprocess.check_output(cmd, + universal_newlines=True, + shell=True) + return output.rstrip() except subprocess.CalledProcessError as e: logger.error("Return code was " + str(e.returncode)) raise -- cgit v1.2.3