summaryrefslogtreecommitdiffstats
path: root/lib
diff options
context:
space:
mode:
authorMartin Krizek <martin.krizek@gmail.com>2020-06-10 19:12:11 +0200
committerGitHub <noreply@github.com>2020-06-10 19:12:11 +0200
commitac2046637510eed8e31ca0c88aebce3279f38070 (patch)
tree7780190587d769ca75044bebbdb53aff9556e9c6 /lib
parentAdditional ansible-test sanity adjustments. (#69974) (diff)
downloadansible-ac2046637510eed8e31ca0c88aebce3279f38070.tar.xz
ansible-ac2046637510eed8e31ca0c88aebce3279f38070.zip
Do not keep empty blocks after tag filtering (#69987)
This prevents PlayIterator having to go through empty blocks that were created in filter_tagged_tasks. This should be a performance improvement for playbooks that mostly skip tasks with tags. ci_complete
Diffstat (limited to 'lib')
-rw-r--r--lib/ansible/playbook/block.py4
1 files changed, 3 insertions, 1 deletions
diff --git a/lib/ansible/playbook/block.py b/lib/ansible/playbook/block.py
index 71fde71500..5f766e0083 100644
--- a/lib/ansible/playbook/block.py
+++ b/lib/ansible/playbook/block.py
@@ -371,7 +371,9 @@ class Block(Base, Conditional, CollectionSearch, Taggable):
tmp_list = []
for task in target:
if isinstance(task, Block):
- tmp_list.append(evaluate_block(task))
+ filtered_block = evaluate_block(task)
+ if filtered_block.has_tasks():
+ tmp_list.append(filtered_block)
elif (task.action == 'meta' or
(task.action == 'include' and task.evaluate_tags([], self._play.skip_tags, all_vars=all_vars)) or
task.evaluate_tags(self._play.only_tags, self._play.skip_tags, all_vars=all_vars)):