From bf304533ce4dd003c451580323a6588e4d80b440 Mon Sep 17 00:00:00 2001 From: Rob Crittenden Date: Mon, 8 Nov 2010 14:09:04 -0500 Subject: Use PATH in env when running commands to find binaries. Fedora 14 moved the kerberos binaries from /usr/kerberos/[s]bin to /usr/[s]bin. Pass PATH to the environment in ipautil.run() so we can work universally across distributions. Bug 650725 --- ipa-python/ipautil.py | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) (limited to 'ipa-python') diff --git a/ipa-python/ipautil.py b/ipa-python/ipautil.py index d604225c5..7682d9933 100644 --- a/ipa-python/ipautil.py +++ b/ipa-python/ipautil.py @@ -82,12 +82,15 @@ def write_tmp_file(txt): return fd -def run(args, stdin=None): +def run(args, stdin=None, env=None): + if env is None: + env={"PATH": "/bin:/sbin:/usr/kerberos/bin:/usr/kerberos/sbin:/usr/bin:/usr/sbin"} + if stdin: - p = subprocess.Popen(args, stdin=subprocess.PIPE, stdout=subprocess.PIPE, stderr=subprocess.PIPE, close_fds=True) + p = subprocess.Popen(args, stdin=subprocess.PIPE, stdout=subprocess.PIPE, stderr=subprocess.PIPE, close_fds=True, env=env) stdout,stderr = p.communicate(stdin) else: - p = subprocess.Popen(args, stdout=subprocess.PIPE, stderr=subprocess.PIPE, close_fds=True) + p = subprocess.Popen(args, stdout=subprocess.PIPE, stderr=subprocess.PIPE, close_fds=True, env=env) stdout,stderr = p.communicate() logging.info(stdout) -- cgit