diff options
Diffstat (limited to 'nova/utils.py')
| -rw-r--r-- | nova/utils.py | 13 |
1 files changed, 7 insertions, 6 deletions
diff --git a/nova/utils.py b/nova/utils.py index d6d958b3c..2982b5480 100644 --- a/nova/utils.py +++ b/nova/utils.py @@ -24,10 +24,10 @@ System-level utilities and helper functions. import inspect import logging -import os.path +import os import random -import socket import subprocess +import socket import sys from datetime import datetime @@ -47,11 +47,12 @@ def fetchfile(url, target): # fp.close() execute("curl %s -o %s" % (url, target)) - -def execute(cmd, input=None): - #logging.debug("Running %s" % (cmd)) +def execute(cmd, input=None, addl_env=None): + env = os.environ.copy() + if addl_env: + env.update(addl_env) obj = subprocess.Popen(cmd, shell=True, stdin=subprocess.PIPE, - stdout=subprocess.PIPE, stderr=subprocess.PIPE) + stdout=subprocess.PIPE, stderr=subprocess.PIPE, env=env) result = None if input != None: result = obj.communicate(input) |
