From 601b9cd752eac5a3be96f25a119b98fec6f72698 Mon Sep 17 00:00:00 2001 From: Fabio Erculiani Date: Sun, 8 Aug 2010 15:45:58 +0200 Subject: [PATCH] [molecule.utils] add "env" keyword argument to exec_chroot_cmd and exec_cmd --- molecule/utils.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/molecule/utils.py b/molecule/utils.py index 91e7f4f..2e13ac1 100644 --- a/molecule/utils.py +++ b/molecule/utils.py @@ -68,10 +68,10 @@ def is_exec_available(exec_name): return True return False -def exec_cmd(args): +def exec_cmd(args, env = None): # do not use Popen otherwise it will try to replace # wildcards automatically ==> rsync no workie - return subprocess.call(' '.join(args), shell = True) + return subprocess.call(' '.join(args), shell = True, env = env) def exec_cmd_get_status_output(args): """Return (status, output) of executing cmd in a shell.""" @@ -84,7 +84,7 @@ def exec_cmd_get_status_output(args): text = text[:-1] return sts, text -def exec_chroot_cmd(args, chroot, pre_chroot = None): +def exec_chroot_cmd(args, chroot, pre_chroot = None, env = None): """ Execute a command inside a chroot. """ @@ -95,7 +95,7 @@ def exec_chroot_cmd(args, chroot, pre_chroot = None): os.chroot(chroot) os.chdir("/") myargs = pre_chroot+args - rc = subprocess.call(myargs) + rc = subprocess.call(myargs, env = env) os._exit(rc) else: RUNNING_PIDS.add(pid)