From 278c379e077b398685db1ebff5d72ddcc4f9b78e Mon Sep 17 00:00:00 2001 From: Nico Schottelius Date: Thu, 6 Oct 2011 13:37:12 +0200 Subject: [PATCH] use os.environ['__remote_exec'] in exec* Signed-off-by: Nico Schottelius --- lib/cdist/exec.py | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/lib/cdist/exec.py b/lib/cdist/exec.py index 9cedefcc..aaa2c13f 100644 --- a/lib/cdist/exec.py +++ b/lib/cdist/exec.py @@ -20,6 +20,7 @@ # import logging +import os import subprocess 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" ] if remote_prefix: - args[0][:0] = remote_prefix + args[0][:0] = os.environ['__remote_exec'] log.debug("Shell exec cmd: %s", args) @@ -43,8 +44,8 @@ def shell_run_or_debug_fail(script, *args, remote_prefix=False, **kargs): subprocess.check_call(*args, **kargs) except subprocess.CalledProcessError: 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: try: @@ -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): if remote_prefix: - args[0][:0] = remote_prefix + args[0][:0] = os.environ['__remote_exec'] log.debug("Exec: " + " ".join(*args)) try: