diff options
| author | Vishvananda Ishaya <vishvananda@gmail.com> | 2010-07-14 16:27:18 -0500 |
|---|---|---|
| committer | Vishvananda Ishaya <vishvananda@gmail.com> | 2010-07-14 16:27:18 -0500 |
| commit | 56e601cb758347262fb2dcc3e980fe50dfeeb9f2 (patch) | |
| tree | 95ea80459d8ad358fba5d0058816b6ee81e3f720 /nova/utils.py | |
| parent | 3326f48e9871dc9e19b516e7541a70e6aa329e74 (diff) | |
| parent | faada0612d8e8580a2a932626c8972b7c2a4ef59 (diff) | |
| download | nova-56e601cb758347262fb2dcc3e980fe50dfeeb9f2.tar.gz nova-56e601cb758347262fb2dcc3e980fe50dfeeb9f2.tar.xz nova-56e601cb758347262fb2dcc3e980fe50dfeeb9f2.zip | |
Merge of DHCP changes including dnsmasq callbacks
Conflicts:
nova/utils.py
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) |
