aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSander Vrijders <sander.vrijders@ugent.be>2018-05-30 16:21:08 +0200
committerSander Vrijders <sander.vrijders@ugent.be>2018-06-05 10:09:10 +0200
commita389849c5b827fa5aac8ff93a1241c642cd300e6 (patch)
tree55b93109824ca57396904719c3c0b405999007fe
parentd39179eed89bcca5ed011df9a571dfebff109b56 (diff)
downloadrumba-a389849c5b827fa5aac8ff93a1241c642cd300e6.tar.gz
rumba-a389849c5b827fa5aac8ff93a1241c642cd300e6.zip
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.
-rw-r--r--rumba/executors/local.py5
1 files changed, 4 insertions, 1 deletions
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