diff options
| author | Alex Meade <alex.meade@rackspace.com> | 2011-06-08 09:28:04 -0400 |
|---|---|---|
| committer | Alex Meade <alex.meade@rackspace.com> | 2011-06-08 09:28:04 -0400 |
| commit | b91ff4561b1c929718dd7a92bb8d8ebc7c841b38 (patch) | |
| tree | ce3ceb17305eb654b07d3105f91196249be67462 /nova/utils.py | |
| parent | a605905c11d8898e8cc15e830c17de3ce8c80fda (diff) | |
| parent | 8ff87c649e13e21ba968ec85a1158230e8cf118d (diff) | |
merge trunk
Diffstat (limited to 'nova/utils.py')
| -rw-r--r-- | nova/utils.py | 18 |
1 files changed, 10 insertions, 8 deletions
diff --git a/nova/utils.py b/nova/utils.py index b1638e72c..691134ada 100644 --- a/nova/utils.py +++ b/nova/utils.py @@ -142,24 +142,26 @@ def execute(*cmd, **kwargs): env = os.environ.copy() if addl_env: env.update(addl_env) + _PIPE = subprocess.PIPE # pylint: disable=E1101 obj = subprocess.Popen(cmd, - stdin=subprocess.PIPE, - stdout=subprocess.PIPE, - stderr=subprocess.PIPE, + stdin=_PIPE, + stdout=_PIPE, + stderr=_PIPE, env=env) result = None if process_input is not None: result = obj.communicate(process_input) else: result = obj.communicate() - obj.stdin.close() - if obj.returncode: - LOG.debug(_('Result was %s') % obj.returncode) + obj.stdin.close() # pylint: disable=E1101 + _returncode = obj.returncode # pylint: disable=E1101 + if _returncode: + LOG.debug(_('Result was %s') % _returncode) if type(check_exit_code) == types.IntType \ - and obj.returncode != check_exit_code: + and _returncode != check_exit_code: (stdout, stderr) = result raise exception.ProcessExecutionError( - exit_code=obj.returncode, + exit_code=_returncode, stdout=stdout, stderr=stderr, cmd=' '.join(cmd)) |
