summaryrefslogtreecommitdiffstats
path: root/nova/utils.py
diff options
context:
space:
mode:
authorEric Windisch <eric@cloudscaling.com>2011-03-09 15:33:20 -0500
committerEric Windisch <eric@cloudscaling.com>2011-03-09 15:33:20 -0500
commitfc9840bae6200c8f89fb8a3ba0ab45663c872b3c (patch)
tree3c1eb10004c40aa31939a9c694c21a30c9aa68a1 /nova/utils.py
parent23369a63f4b74fb64bf57554a3fd8b15e3e2b49c (diff)
downloadnova-fc9840bae6200c8f89fb8a3ba0ab45663c872b3c.tar.gz
nova-fc9840bae6200c8f89fb8a3ba0ab45663c872b3c.tar.xz
nova-fc9840bae6200c8f89fb8a3ba0ab45663c872b3c.zip
execvp passes pep8
Diffstat (limited to 'nova/utils.py')
-rw-r--r--nova/utils.py19
1 files changed, 10 insertions, 9 deletions
diff --git a/nova/utils.py b/nova/utils.py
index 0937522ec..3a4ec3c6a 100644
--- a/nova/utils.py
+++ b/nova/utils.py
@@ -40,7 +40,7 @@ import netaddr
from eventlet import event
from eventlet import greenthread
from eventlet.green import subprocess
-
+None
from nova import exception
from nova.exception import ProcessExecutionError
from nova import log as logging
@@ -129,13 +129,13 @@ def fetchfile(url, target):
def execute(*cmd, **kwargs):
- process_input=kwargs.get('process_input', None)
- addl_env=kwargs.get('addl_env', None)
- check_exit_code=kwargs.get('check_exit_code', 0)
- stdin=kwargs.get('stdin', subprocess.PIPE)
- stdout=kwargs.get('stdout', subprocess.PIPE)
- stderr=kwargs.get('stderr', subprocess.PIPE)
- cmd=map(str,cmd)
+ process_input = kwargs.get('process_input', None)
+ addl_env = kwargs.get('addl_env', None)
+ check_exit_code = kwargs.get('check_exit_code', 0)
+ stdin = kwargs.get('stdin', subprocess.PIPE)
+ stdout = kwargs.get('stdout', subprocess.PIPE)
+ stderr = kwargs.get('stderr', subprocess.PIPE)
+ cmd = map(str, cmd)
LOG.debug(_("Running cmd (subprocess): %s"), ' '.join(cmd))
env = os.environ.copy()
@@ -151,7 +151,8 @@ def execute(*cmd, **kwargs):
obj.stdin.close()
if obj.returncode:
LOG.debug(_("Result was %s") % obj.returncode)
- if check_exit_code is not None and obj.returncode != check_exit_code:
+ if type(check_exit_code) == types.IntType \
+ and obj.returncode != check_exit_code:
(stdout, stderr) = result
raise ProcessExecutionError(exit_code=obj.returncode,
stdout=stdout,