summaryrefslogtreecommitdiffstats
path: root/nova/utils.py
diff options
context:
space:
mode:
authorJoshua McKenty <jmckenty@joshua-mckentys-macbook-pro.local>2010-07-07 12:06:34 -0700
committerVishvananda Ishaya <vishvananda@gmail.com>2010-07-07 12:06:34 -0700
commitb7ea2f70581f6acd927ea7b65adaffeeb4b8d2ba (patch)
tree6f00bf4a6207486478b0142f0297081ebcf85d8d /nova/utils.py
parent5e8337aec03f5a697c90779eb66a457aae4e7ae0 (diff)
downloadnova-b7ea2f70581f6acd927ea7b65adaffeeb4b8d2ba.tar.gz
nova-b7ea2f70581f6acd927ea7b65adaffeeb4b8d2ba.tar.xz
nova-b7ea2f70581f6acd927ea7b65adaffeeb4b8d2ba.zip
Capture signals from dnsmasq and use them to update network state.
Diffstat (limited to 'nova/utils.py')
-rw-r--r--nova/utils.py10
1 files changed, 7 insertions, 3 deletions
diff --git a/nova/utils.py b/nova/utils.py
index 325b062ee..cbfdd835d 100644
--- a/nova/utils.py
+++ b/nova/utils.py
@@ -26,6 +26,7 @@ import logging
import socket
import sys
import os.path
+from os import environ
import inspect
import subprocess
import random
@@ -46,11 +47,14 @@ def fetchfile(url, target):
# fp.close()
execute("curl %s -o %s" % (url, target))
-
-def execute(cmd, input=None):
+def execute(cmd, input=None, addl_env=None):
#logging.debug("Running %s" % (cmd))
+ env = os.environ.copy()
+ if addl_env:
+ env.update(addl_env)
+ logging.debug(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)