1
0
Fork 0
mirror of https://github.com/ansible-collections/community.general.git synced 2024-09-14 20:13:21 +02:00

Restore "skipping: no hosts matched" message

In 159aa26b36
the result of _get_serialized_branches when no hosts were matched
changed from [[]] to []. Thus, the v2_playbook_on_no_hosts_matched
callback would not fire. Change the check so we get the error message
again. Fixes #17706
This commit is contained in:
stephane 2016-10-06 15:38:40 -07:00 committed by Brian Coca
parent 1293ec85dd
commit 1b8c2a2b0b

View file

@ -142,12 +142,11 @@ class PlaybookExecutor:
break_play = False break_play = False
# we are actually running plays # we are actually running plays
for batch in self._get_serialized_batches(new_play): batches = self._get_serialized_batches(new_play)
if len(batch) == 0: if len(batches) == 0:
self._tqm.send_callback('v2_playbook_on_play_start', new_play) self._tqm.send_callback('v2_playbook_on_play_start', new_play)
self._tqm.send_callback('v2_playbook_on_no_hosts_matched') self._tqm.send_callback('v2_playbook_on_no_hosts_matched')
break for batch in batches:
# restrict the inventory to the hosts in the serialized batch # restrict the inventory to the hosts in the serialized batch
self._inventory.restrict_to_hosts(batch) self._inventory.restrict_to_hosts(batch)
# and run it... # and run it...