diff options
author | Tristan Cacqueray <tdecacqu@redhat.com> | 2019-11-26 13:04:28 +0000 |
---|---|---|
committer | Tristan Cacqueray <tdecacqu@redhat.com> | 2019-11-26 13:26:53 +0000 |
commit | 9741018ff63ad8184f33b35d44b427a93b289624 (patch) | |
tree | 74cd8379637bc9b839ca4e60d6ad1b49c29b19cf /zuul/ansible/base/callback/zuul_stream.py | |
parent | 15c74ce60b611073edef0c59c829d98a6ac9f5d1 (diff) | |
download | zuul-9741018ff63ad8184f33b35d44b427a93b289624.tar.gz |
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
Diffstat (limited to 'zuul/ansible/base/callback/zuul_stream.py')
-rw-r--r-- | zuul/ansible/base/callback/zuul_stream.py | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/zuul/ansible/base/callback/zuul_stream.py b/zuul/ansible/base/callback/zuul_stream.py index fabe972e0..084a47f12 100644 --- a/zuul/ansible/base/callback/zuul_stream.py +++ b/zuul/ansible/base/callback/zuul_stream.py @@ -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( |