forked from ungleich-public/cdist
use os.environ['__remote_exec'] in exec*
Signed-off-by: Nico Schottelius <nico@kr.ethz.ch>
This commit is contained in:
parent
ecc4fc10d7
commit
278c379e07
1 changed files with 5 additions and 4 deletions
|
@ -20,6 +20,7 @@
|
||||||
#
|
#
|
||||||
|
|
||||||
import logging
|
import logging
|
||||||
|
import os
|
||||||
import subprocess
|
import subprocess
|
||||||
|
|
||||||
log = logging.getLogger(__name__)
|
log = logging.getLogger(__name__)
|
||||||
|
@ -32,7 +33,7 @@ def shell_run_or_debug_fail(script, *args, remote_prefix=False, **kargs):
|
||||||
args[0][:0] = [ "/bin/sh", "-e" ]
|
args[0][:0] = [ "/bin/sh", "-e" ]
|
||||||
|
|
||||||
if remote_prefix:
|
if remote_prefix:
|
||||||
args[0][:0] = remote_prefix
|
args[0][:0] = os.environ['__remote_exec']
|
||||||
|
|
||||||
log.debug("Shell exec cmd: %s", args)
|
log.debug("Shell exec cmd: %s", args)
|
||||||
|
|
||||||
|
@ -43,7 +44,7 @@ def shell_run_or_debug_fail(script, *args, remote_prefix=False, **kargs):
|
||||||
subprocess.check_call(*args, **kargs)
|
subprocess.check_call(*args, **kargs)
|
||||||
except subprocess.CalledProcessError:
|
except subprocess.CalledProcessError:
|
||||||
log.error("Code that raised the error:\n")
|
log.error("Code that raised the error:\n")
|
||||||
if remote_prefix:
|
|
||||||
run_or_fail(["cat", script], remote_prefix=remote_prefix)
|
run_or_fail(["cat", script], remote_prefix=remote_prefix)
|
||||||
|
|
||||||
else:
|
else:
|
||||||
|
@ -60,7 +61,7 @@ def shell_run_or_debug_fail(script, *args, remote_prefix=False, **kargs):
|
||||||
|
|
||||||
def run_or_fail(*args, remote_prefix=False, **kargs):
|
def run_or_fail(*args, remote_prefix=False, **kargs):
|
||||||
if remote_prefix:
|
if remote_prefix:
|
||||||
args[0][:0] = remote_prefix
|
args[0][:0] = os.environ['__remote_exec']
|
||||||
|
|
||||||
log.debug("Exec: " + " ".join(*args))
|
log.debug("Exec: " + " ".join(*args))
|
||||||
try:
|
try:
|
||||||
|
|
Loading…
Reference in a new issue