summaryrefslogtreecommitdiff
path: root/lib/ansible/executor
diff options
context:
space:
mode:
authorstephane <stephane@alum.mit.edu>2016-10-06 15:38:40 -0700
committerBrian Coca <bcoca@users.noreply.github.com>2017-02-08 16:03:29 -0500
commit1b8c2a2b0b1b87b41598f44ae57b17dfcc83ac73 (patch)
treecce19fae0d4393bd7b37869785df246b77998ab6 /lib/ansible/executor
parent1293ec85dd68dfc31183ae9ec654333301103660 (diff)
downloadansible-1b8c2a2b0b1b87b41598f44ae57b17dfcc83ac73.tar.gz
Restore "skipping: no hosts matched" message
In https://github.com/ansible/ansible/commit/159aa26b36a6455ebc38d527c294c60899892c04 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
Diffstat (limited to 'lib/ansible/executor')
-rw-r--r--lib/ansible/executor/playbook_executor.py11
1 files changed, 5 insertions, 6 deletions
diff --git a/lib/ansible/executor/playbook_executor.py b/lib/ansible/executor/playbook_executor.py
index 39e95c2261..5923deafc0 100644
--- a/lib/ansible/executor/playbook_executor.py
+++ b/lib/ansible/executor/playbook_executor.py
@@ -142,12 +142,11 @@ class PlaybookExecutor:
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...