Fix KeysView object does not support indexing
The KeysView we get from the hostvars is not indexable and throws an error [1] when trying to access via an index. This can be fixed by using an iterator and getting one item. [1] Log: [WARNING]: Failure using method (v2_playbook_on_play_start) in callback plugin (<ansible.plugins.callback.zuul_stream.CallbackModule object at 0x7f5d41b73b70>): 'KeysView' object does not support indexing Change-Id: I0c95b55a3b26856e9d101db95682efa0e0694523
This commit is contained in:
parent
e391ec8df8
commit
5b7a042e3b
|
@ -161,7 +161,7 @@ class CallbackModule(default.CallbackModule):
|
|||
# Get the hostvars from just one host - the vars we're looking for will
|
||||
# be identical on all of them
|
||||
hostvars = self._play._variable_manager._hostvars
|
||||
a_host = hostvars.keys()[0]
|
||||
a_host = next(iter(hostvars.keys()))
|
||||
self.phase = hostvars[a_host]['zuul_execution_phase']
|
||||
if self.phase != 'run':
|
||||
self.phase = '{phase}-{index}'.format(
|
||||
|
|
Loading…
Reference in New Issue