summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--nova/process.py17
1 files changed, 11 insertions, 6 deletions
diff --git a/nova/process.py b/nova/process.py
index b114146ce..8e7efd4ee 100644
--- a/nova/process.py
+++ b/nova/process.py
@@ -1,12 +1,12 @@
# vim: tabstop=4 shiftwidth=4 softtabstop=4
# Copyright [2010] [Anso Labs, LLC]
-#
+#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
-#
+#
# http://www.apache.org/licenses/LICENSE-2.0
-#
+#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@@ -118,7 +118,7 @@ class BackRelayWithInput(_BackRelay):
def errReceivedIsGood(self, text):
self.stderr.write(text)
-
+
def connectionMade(self):
if self.startedDeferred:
self.startedDeferred.callback(self)
@@ -151,6 +151,11 @@ def getProcessOutput(executable, args=None, env=None, path=None, reactor=None,
d = defer.Deferred()
p = BackRelayWithInput(
d, startedDeferred=startedDeferred, error_ok=error_ok, input=input)
+ # VISH: commands come in as unicode, but self.executes needs
+ # strings or process.spawn raises a deprecation warning
+ executable = str(executable)
+ if not args is None:
+ args = [str(x) for x in args]
reactor.spawnProcess(p, executable, (executable,)+tuple(args), env, path)
return d
@@ -167,7 +172,7 @@ class ProcessPool(object):
def simpleExecute(self, cmd, **kw):
""" Weak emulation of the old utils.execute() function.
-
+
This only exists as a way to quickly move old execute methods to
this new style of code.
@@ -190,7 +195,7 @@ class ProcessPool(object):
d.process = None
d.started = started
-
+
d.addCallback(lambda _: getProcessOutput(*args, **kw))
d.addBoth(self._release)
return d