Merge "Fixed issues on Python 3"

This commit is contained in:
Jenkins 2016-12-01 01:45:10 +00:00 committed by Gerrit Code Review
commit dfb4eaed3d
3 changed files with 7 additions and 3 deletions

View File

@ -33,6 +33,8 @@ class Message(object):
try:
if message_handle:
if isinstance(message_handle.body, bytes):
message_handle.body = message_handle.body.decode('utf-8')
self.body = anyjson.loads(message_handle.body)
else:
self.body = None

View File

@ -43,7 +43,7 @@ class ExecutionPlanRunner(object):
@staticmethod
def _unindent(script, initial_indent):
lines = script.expandtabs(4).split('\n')
min_indent = sys.maxint
min_indent = six.MAXSIZE
for line in lines:
indent = -1
for i, c in enumerate(line):

View File

@ -70,11 +70,13 @@ class ApplicationExecutor(object):
LOG.debug("Script {0} execution finished "
"with retcode: {1}".format(script_name, retcode))
if stdout is not None:
stdout = stdout.decode('utf-8')
if hasattr(stdout, 'decode'):
stdout = stdout.decode('utf-8')
LOG.debug(u"'{0}' execution stdout: "
u"'{1}'".format(script_name, stdout))
if stderr is not None:
stderr = stderr.decode('utf-8')
if hasattr(stderr, 'decode'):
stderr = stderr.decode('utf-8')
LOG.debug(u"'{0}' execution stderr: "
u"'{1}'".format(script_name, stderr))
result = {