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
This commit is contained in:
parent
0d756babef
commit
2da000e9b0
|
@ -91,6 +91,7 @@ class MuranoAgent(service.Service):
|
||||||
result, plan)
|
result, plan)
|
||||||
self._queue.put_execution_result(execution_result, plan)
|
self._queue.put_execution_result(execution_result, plan)
|
||||||
except Exception as ex:
|
except Exception as ex:
|
||||||
|
LOG.exception('Error running execution plan')
|
||||||
execution_result = ex_result.ExecutionResult.from_error(ex,
|
execution_result = ex_result.ExecutionResult.from_error(ex,
|
||||||
plan)
|
plan)
|
||||||
self._queue.put_execution_result(execution_result, plan)
|
self._queue.put_execution_result(execution_result, plan)
|
||||||
|
|
|
@ -46,7 +46,7 @@ class ExecutionResult(object):
|
||||||
if isinstance(error, int):
|
if isinstance(error, int):
|
||||||
error_code = error
|
error_code = error
|
||||||
elif isinstance(error, Exception):
|
elif isinstance(error, Exception):
|
||||||
message = error.message
|
message = unicode(error)
|
||||||
if isinstance(error, exc.AgentException):
|
if isinstance(error, exc.AgentException):
|
||||||
error_code = error.error_code
|
error_code = error.error_code
|
||||||
additional_info = error.additional_data
|
additional_info = error.additional_data
|
||||||
|
|
|
@ -62,13 +62,15 @@ class ApplicationExecutor(object):
|
||||||
stdout, stderr = process.communicate(input)
|
stdout, stderr = process.communicate(input)
|
||||||
retcode = process.poll()
|
retcode = process.poll()
|
||||||
LOG.debug("Script {0} execution finished "
|
LOG.debug("Script {0} execution finished "
|
||||||
"with retcode: '{1}'".format(script_name, str(retcode)))
|
"with retcode: {1}".format(script_name, retcode))
|
||||||
if stdout:
|
if stdout is not None:
|
||||||
LOG.debug("'{0}' execution stdout: "
|
stdout = stdout.decode('utf-8')
|
||||||
"'{1}'".format(script_name, stdout))
|
LOG.debug(u"'{0}' execution stdout: "
|
||||||
if stderr:
|
u"'{1}'".format(script_name, stdout))
|
||||||
LOG.debug("'{0}' execution stderr: "
|
if stderr is not None:
|
||||||
"'{1}'".format(script_name, stderr))
|
stderr = stderr.decode('utf-8')
|
||||||
|
LOG.debug(u"'{0}' execution stderr: "
|
||||||
|
u"'{1}'".format(script_name, stderr))
|
||||||
result = {
|
result = {
|
||||||
'exitCode': retcode,
|
'exitCode': retcode,
|
||||||
'stdout': stdout.strip() if stdout else None,
|
'stdout': stdout.strip() if stdout else None,
|
||||||
|
|
Loading…
Reference in New Issue