zuul_stream: handle module that emit non str msg

This change prevents an exception from happening in the zuul_stream
module when the msg result is a list instead of a string.
This is the case for the package module trying to install missing rpm
on ansible 2.8 with python3.

Change-Id: I242711ebc0b2dcd1262de38e76efc48554361bd1
Story: 2006830
This commit is contained in:
Tristan Cacqueray 2019-11-26 13:04:28 +00:00
parent 15c74ce60b
commit 9741018ff6
1 changed files with 4 additions and 1 deletions

View File

@ -330,10 +330,13 @@ class CallbackModule(default.CallbackModule):
self._process_result_for_localhost(result)
def is_module_failure(msg):
return isinstance(msg, str) and msg.startswith('MODULE FAILURE')
if result._task.loop and 'results' in result_dict:
# items have their own events
pass
elif result_dict.get('msg', '').startswith('MODULE FAILURE'):
elif is_module_failure(result_dict.get('msg', '')):
self._log_module_failure(result, result_dict)
else:
self._log_message(