diff options
author | Lars Kellogg-Stedman <lars@redhat.com> | 2016-05-05 23:45:06 -0400 |
---|---|---|
committer | James Cammarata <jimi@sngx.net> | 2016-05-12 10:23:06 -0400 |
commit | 22b86bbb63033bddb6b1edd994d8f34cd8e4dafc (patch) | |
tree | efb8bf2bf118ef6d99a60860cf7bca8a13b46559 | |
parent | 00b04ab7949e23b625a5dbc90c84f2bb4d8e426d (diff) | |
download | ansible-22b86bbb63033bddb6b1edd994d8f34cd8e4dafc.tar.gz |
do not erroneously set gathered_facts=True
In `lib/ansible/executor/play_iterator.py`, ansible sets a host's
`_gathered_facts` property to `True` without checking to see if there
are any tasks to be executed. In the event that the entire play is
skipped, `_gathered_facts` will be `True` even though the `setup`
module was never run.
This patch modifies the logic to only set `_gathered_facts` to `True`
when there are tasks to execute.
Closes #15744.
-rw-r--r-- | lib/ansible/executor/play_iterator.py | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/lib/ansible/executor/play_iterator.py b/lib/ansible/executor/play_iterator.py index 9ecda9395c..6a40d2a4bf 100644 --- a/lib/ansible/executor/play_iterator.py +++ b/lib/ansible/executor/play_iterator.py @@ -295,10 +295,10 @@ class PlayIterator: setup_block = self._blocks[0] if setup_block.has_tasks() and len(setup_block.block) > 0: task = setup_block.block[0] - if not peek: - # mark the host as having gathered facts, because we're - # returning the setup task to be executed - host.set_gathered_facts(True) + if not peek: + # mark the host as having gathered facts, because we're + # returning the setup task to be executed + host.set_gathered_facts(True) else: # This is the second trip through ITERATING_SETUP, so we clear # the flag and move onto the next block in the list while setting |