Improve windows logging

Currently we don't have any stdout logs with windows at all in the
buildlog but only in the json log. This is a little bit
inconvenient. As live streaming doesn't work at the moment for windows
just don't live stream win_shell and win_command tasks but treat them
similar to localhost tasks and loop items. With this we at least get
after the fact stdout logs of these tasks.

Change-Id: Ieda6cb51dd6af0d5fb4d0a1f6f7d60d66c9fd7cb
This commit is contained in:
Tobias Henkel 2018-11-06 07:38:12 +01:00
parent 0ae7a157e2
commit 265803dd56
No known key found for this signature in database
GPG Key ID: 03750DEC158E5FA2
1 changed files with 10 additions and 4 deletions

View File

@ -281,9 +281,13 @@ class CallbackModule(default.CallbackModule):
if not is_localhost and is_task:
self._stop_streamers()
if result._task.action in ('command', 'shell'):
if result._task.action in ('command', 'shell',
'win_command', 'win_shell'):
stdout_lines = zuul_filter_result(result_dict)
if is_localhost:
# We don't have streaming for localhost and windows modules so get
# standard out after the fact.
if is_localhost or result._task.action in (
'win_command', 'win_shell'):
for line in stdout_lines:
hostname = self._get_hostname(result)
self._log("%s | %s " % (hostname, line))
@ -452,7 +456,8 @@ class CallbackModule(default.CallbackModule):
self._log_message(
result, status='MODULE FAILURE',
msg="Item: {item}\n{module_stdout}".format(**result_dict))
elif result._task.action not in ('command', 'shell'):
elif result._task.action not in ('command', 'shell',
'win_command', 'win_shell'):
if 'msg' in result_dict:
self._log_message(
result=result, msg=result_dict['msg'], status=status)
@ -490,7 +495,8 @@ class CallbackModule(default.CallbackModule):
self._log_message(
result, status='MODULE FAILURE',
msg="Item: {item}\n{module_stdout}".format(**result_dict))
elif result._task.action not in ('command', 'shell'):
elif result._task.action not in ('command', 'shell',
'win_command', 'win_shell'):
self._log_message(
result=result,
msg="Item: {item}".format(item=result_dict['item']),