summaryrefslogtreecommitdiffstats
path: root/src/lib/Bcfg2/Utils.py
diff options
context:
space:
mode:
authorSol Jerome <sol.jerome@gmail.com>2013-04-10 09:46:12 -0500
committerSol Jerome <sol.jerome@gmail.com>2013-04-10 09:46:12 -0500
commit2cb245f4ebf5dbd37f11f02a7d1598b050799515 (patch)
treef1173fc1b7567a0f4ea498b5fb485a37277175b9 /src/lib/Bcfg2/Utils.py
parent2d861fb3c2ef62bfbf15ced8bca4e86dba0f439b (diff)
downloadbcfg2-2cb245f4ebf5dbd37f11f02a7d1598b050799515.tar.gz
bcfg2-2cb245f4ebf5dbd37f11f02a7d1598b050799515.tar.bz2
bcfg2-2cb245f4ebf5dbd37f11f02a7d1598b050799515.zip
RcUpdate: Fix detection of running services
Signed-off-by: Sol Jerome <sol.jerome@gmail.com>
Diffstat (limited to 'src/lib/Bcfg2/Utils.py')
-rw-r--r--src/lib/Bcfg2/Utils.py17
1 files changed, 15 insertions, 2 deletions
diff --git a/src/lib/Bcfg2/Utils.py b/src/lib/Bcfg2/Utils.py
index 39cf5255e..581445bf4 100644
--- a/src/lib/Bcfg2/Utils.py
+++ b/src/lib/Bcfg2/Utils.py
@@ -108,10 +108,16 @@ class ExecutorResult(object):
def __init__(self, stdout, stderr, retval):
#: The output of the command
- self.stdout = stdout
+ if isinstance(stdout, str):
+ self.stdout = stdout
+ else:
+ self.stdout = stdout.decode('utf-8')
#: The error produced by the command
- self.stderr = stderr
+ if isinstance(stdout, str):
+ self.stderr = stderr
+ else:
+ self.stderr = stderr.decode('utf-8')
#: The return value of the command.
self.retval = retval
@@ -234,6 +240,13 @@ class Executor(object):
for line in inputdata.splitlines():
self.logger.debug('> %s' % line)
(stdout, stderr) = proc.communicate(input=inputdata)
+
+ # py3k fixes
+ if not isinstance(stdout, str):
+ stdout = stdout.decode('utf-8')
+ if not isinstance(stderr, str):
+ stderr = stderr.decode('utf-8')
+
for line in stdout.splitlines(): # pylint: disable=E1103
self.logger.debug('< %s' % line)
for line in stderr.splitlines(): # pylint: disable=E1103