Skip to content

Commit

Permalink
Restore "skipping: no hosts matched" message
Browse files Browse the repository at this point in the history
In ansible@159aa26
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 ansible#17706
  • Loading branch information
cinerama70 authored and bcoca committed Feb 8, 2017
1 parent 1293ec8 commit 1b8c2a2
Showing 1 changed file with 5 additions and 6 deletions.
11 changes: 5 additions & 6 deletions lib/ansible/executor/playbook_executor.py
Original file line number Diff line number Diff line change
Expand Up @@ -142,12 +142,11 @@ def run(self):

break_play = False
# we are actually running plays
for batch in self._get_serialized_batches(new_play):
if len(batch) == 0:
self._tqm.send_callback('v2_playbook_on_play_start', new_play)
self._tqm.send_callback('v2_playbook_on_no_hosts_matched')
break

batches = self._get_serialized_batches(new_play)
if len(batches) == 0:
self._tqm.send_callback('v2_playbook_on_play_start', new_play)
self._tqm.send_callback('v2_playbook_on_no_hosts_matched')
for batch in batches:
# restrict the inventory to the hosts in the serialized batch
self._inventory.restrict_to_hosts(batch)
# and run it...
Expand Down

0 comments on commit 1b8c2a2

Please sign in to comment.