summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorVishvananda Ishaya <vishvananda@yahoo.com>2010-09-07 18:32:08 -0700
committerVishvananda Ishaya <vishvananda@yahoo.com>2010-09-07 18:32:08 -0700
commitc3531537aef54b2c27a6e1f28308eac98aec08ba (patch)
treebe13efc85a4b8f1afd1e92e29a7b02b2ebed814c
parentc4bf107b7e4fd64376dab7ebe39e4531f64879c5 (diff)
whitespace fixes
-rw-r--r--nova/process.py44
1 files changed, 22 insertions, 22 deletions
diff --git a/nova/process.py b/nova/process.py
index 069310802..259e62358 100644
--- a/nova/process.py
+++ b/nova/process.py
@@ -35,8 +35,8 @@ FLAGS = flags.FLAGS
flags.DEFINE_integer('process_pool_size', 4,
'Number of processes to use in the process pool')
-# This is based on _BackRelay from twister.internal.utils, but modified to
-# capture both stdout and stderr, without odd stderr handling, and also to
+# This is based on _BackRelay from twister.internal.utils, but modified to
+# capture both stdout and stderr, without odd stderr handling, and also to
# handle stdin
class BackRelayWithInput(protocol.ProcessProtocol):
"""
@@ -46,21 +46,21 @@ class BackRelayWithInput(protocol.ProcessProtocol):
@ivar deferred: A L{Deferred} which will be called back with all of stdout
and all of stderr as well (as a tuple). C{terminate_on_stderr} is true
and any bytes are received over stderr, this will fire with an
- L{_ProcessExecutionError} instance and the attribute will be set to
+ L{_ProcessExecutionError} instance and the attribute will be set to
C{None}.
- @ivar onProcessEnded: If C{terminate_on_stderr} is false and bytes are
- received over stderr, this attribute will refer to a L{Deferred} which
- will be called back when the process ends. This C{Deferred} is also
- associated with the L{_ProcessExecutionError} which C{deferred} fires
- with earlier in this case so that users can determine when the process
+ @ivar onProcessEnded: If C{terminate_on_stderr} is false and bytes are
+ received over stderr, this attribute will refer to a L{Deferred} which
+ will be called back when the process ends. This C{Deferred} is also
+ associated with the L{_ProcessExecutionError} which C{deferred} fires
+ with earlier in this case so that users can determine when the process
has actually ended, in addition to knowing when bytes have been received
via stderr.
"""
- def __init__(self, deferred, cmd, started_deferred=None,
- terminate_on_stderr=False, check_exit_code=True,
- process_input=None):
+ def __init__(self, deferred, cmd, started_deferred=None,
+ terminate_on_stderr=False, check_exit_code=True,
+ process_input=None):
self.deferred = deferred
self.cmd = cmd
self.stdout = StringIO.StringIO()
@@ -70,12 +70,12 @@ class BackRelayWithInput(protocol.ProcessProtocol):
self.check_exit_code = check_exit_code
self.process_input = process_input
self.on_process_ended = None
-
+
def _build_execution_error(self, exit_code=None):
- return ProcessExecutionError( cmd=self.cmd,
- exit_code=exit_code,
- stdout=self.stdout.getvalue(),
- stderr=self.stderr.getvalue())
+ return ProcessExecutionError(cmd=self.cmd,
+ exit_code=exit_code,
+ stdout=self.stdout.getvalue(),
+ stderr=self.stderr.getvalue())
def errReceived(self, text):
self.stderr.write(text)
@@ -101,7 +101,7 @@ class BackRelayWithInput(protocol.ProcessProtocol):
self.deferred.callback((stdout, stderr))
except:
# NOTE(justinsb): This logic is a little suspicious to me...
- # If the callback throws an exception, then errback will be
+ # If the callback throws an exception, then errback will be
# called also. However, this is what the unit tests test for...
self.deferred.errback(self._build_execution_error(exit_code))
elif self.on_process_ended is not None:
@@ -115,8 +115,8 @@ class BackRelayWithInput(protocol.ProcessProtocol):
self.transport.write(self.process_input)
self.transport.closeStdin()
-def get_process_output(executable, args=None, env=None, path=None,
- process_reactor=None, check_exit_code=True,
+def get_process_output(executable, args=None, env=None, path=None,
+ process_reactor=None, check_exit_code=True,
process_input=None, started_deferred=None,
terminate_on_stderr=False):
if process_reactor is None:
@@ -130,8 +130,8 @@ def get_process_output(executable, args=None, env=None, path=None,
process_handler = BackRelayWithInput(
deferred,
cmd,
- started_deferred=started_deferred,
- check_exit_code=check_exit_code,
+ started_deferred=started_deferred,
+ check_exit_code=check_exit_code,
process_input=process_input,
terminate_on_stderr=terminate_on_stderr)
# NOTE(vish): commands come in as unicode, but self.executes needs
@@ -139,7 +139,7 @@ def get_process_output(executable, args=None, env=None, path=None,
executable = str(executable)
if not args is None:
args = [str(x) for x in args]
- process_reactor.spawnProcess( process_handler, executable,
+ process_reactor.spawnProcess( process_handler, executable,
(executable,)+tuple(args), env, path)
return deferred