Unicode characters handling
If script was to produce some non-ascii characters to stdout/stderr
execution plan failed without error message.
This patch fixes unicode handling for those streams
assuming console output is always UTF8/ASCII
Change-Id: Iec9a4b14b3f3d506890b87deb0af66fc196c262d
Closes-Bug: #1398586
(cherry picked from commit 2da000e9b0
)
This commit is contained in:
parent
2bf3d0488d
commit
82ceba5899
|
@ -91,6 +91,7 @@ class MuranoAgent(service.Service):
|
|||
result, plan)
|
||||
self._queue.put_execution_result(execution_result, plan)
|
||||
except Exception as ex:
|
||||
LOG.exception('Error running execution plan')
|
||||
execution_result = ex_result.ExecutionResult.from_error(ex,
|
||||
plan)
|
||||
self._queue.put_execution_result(execution_result, plan)
|
||||
|
|
|
@ -46,7 +46,7 @@ class ExecutionResult(object):
|
|||
if isinstance(error, int):
|
||||
error_code = error
|
||||
elif isinstance(error, Exception):
|
||||
message = error.message
|
||||
message = unicode(error)
|
||||
if isinstance(error, exc.AgentException):
|
||||
error_code = error.error_code
|
||||
additional_info = error.additional_data
|
||||
|
|
|
@ -62,13 +62,15 @@ class ApplicationExecutor(object):
|
|||
stdout, stderr = process.communicate(input)
|
||||
retcode = process.poll()
|
||||
LOG.debug("Script {0} execution finished "
|
||||
"with retcode: '{1}'".format(script_name, str(retcode)))
|
||||
if stdout:
|
||||
LOG.debug("'{0}' execution stdout: "
|
||||
"'{1}'".format(script_name, stdout))
|
||||
if stderr:
|
||||
LOG.debug("'{0}' execution stderr: "
|
||||
"'{1}'".format(script_name, stderr))
|
||||
"with retcode: {1}".format(script_name, retcode))
|
||||
if stdout is not None:
|
||||
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')
|
||||
LOG.debug(u"'{0}' execution stderr: "
|
||||
u"'{1}'".format(script_name, stderr))
|
||||
result = {
|
||||
'exitCode': retcode,
|
||||
'stdout': stdout.strip() if stdout else None,
|
||||
|
|
Loading…
Reference in New Issue