mirror of
https://github.com/ansible/awx.git
synced 2026-02-24 22:46:01 -03:30
Handle both string and list hosts in our hosts->name conversion
Base our play.name fix off of what Ansible will be doing in the next
release: e2d2798a42
This commit is contained in:
@@ -465,8 +465,11 @@ class JobCallbackModule(BaseCallbackModule):
|
|||||||
setattr(self, 'play', play)
|
setattr(self, 'play', play)
|
||||||
# Ansible 2.0.0.2 doesn't default .name to hosts like it did in 1.9.4,
|
# Ansible 2.0.0.2 doesn't default .name to hosts like it did in 1.9.4,
|
||||||
# though that default will likely return in a future version of Ansible.
|
# though that default will likely return in a future version of Ansible.
|
||||||
if not hasattr(play, 'name') or play.name == '':
|
if (not hasattr(play, 'name') or not play.name) and hasattr(play, 'hosts'):
|
||||||
play.name = ', '.join(play.hosts)
|
if isinstance(play.hosts, list):
|
||||||
|
play.name = ','.join(play.hosts)
|
||||||
|
else:
|
||||||
|
play.name = play.hosts
|
||||||
self._log_event('playbook_on_play_start', name=play.name,
|
self._log_event('playbook_on_play_start', name=play.name,
|
||||||
pattern=play.hosts)
|
pattern=play.hosts)
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user