pass remote_prefix to run_or_fail/shell

Signed-off-by: Nico Schottelius <nico@kr.ethz.ch>
This commit is contained in:
Nico Schottelius 2011-09-23 20:35:13 +02:00
parent e14848ec1f
commit 3925ba1c6e

View file

@ -19,7 +19,8 @@
# #
# #
def shell_run_or_debug_fail(self, script, *args, **kargs):
def shell_run_or_debug_fail(script, *args, **kargs):
# Manually execute /bin/sh, because sh -e does what we want # Manually execute /bin/sh, because sh -e does what we want
# and sh -c -e does not exit if /bin/false called # and sh -c -e does not exit if /bin/false called
args[0][:0] = [ "/bin/sh", "-e" ] args[0][:0] = [ "/bin/sh", "-e" ]
@ -27,10 +28,11 @@ def shell_run_or_debug_fail(self, script, *args, **kargs):
remote = False remote = False
if "remote" in kargs: if "remote" in kargs:
if kargs["remote"]: if kargs["remote"]:
args[0][:0] = self.remote_prefix args[0][:0] = kargs["remote_prefix"]
remote = true remote = true
del kargs["remote"] del kargs["remote"]
del kargs["remote_prefix"]
log.debug("Shell exec cmd: %s", args) log.debug("Shell exec cmd: %s", args)
log.debug("Shell exec env: %s", kargs['env']) log.debug("Shell exec env: %s", kargs['env'])
@ -56,9 +58,10 @@ def shell_run_or_debug_fail(self, script, *args, **kargs):
def run_or_fail(self, *args, **kargs): def run_or_fail(self, *args, **kargs):
if "remote" in kargs: if "remote" in kargs:
if kargs["remote"]: if kargs["remote"]:
args[0][:0] = self.remote_prefix args[0][:0] = kargs["remote_prefix"]
del kargs["remote"] del kargs["remote"]
del kargs["remote_prefix"]
log.debug("Exec: " + " ".join(*args)) log.debug("Exec: " + " ".join(*args))
try: try:
@ -67,4 +70,3 @@ def run_or_fail(self, *args, **kargs):
raise CdistError("Command failed: " + " ".join(*args)) raise CdistError("Command failed: " + " ".join(*args))
except OSError as error: except OSError as error:
raise CdistError(" ".join(*args) + ": " + error.args[1]) raise CdistError(" ".join(*args) + ": " + error.args[1])