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
This commit is contained in:
parent
a5679d4dd1
commit
ac20466375
2 changed files with 5 additions and 1 deletions
2
changelogs/fragments/purge-empty-block.yml
Normal file
2
changelogs/fragments/purge-empty-block.yml
Normal file
|
@ -0,0 +1,2 @@
|
||||||
|
bugfixes:
|
||||||
|
- Do not keep empty blocks in PlayIterator after skipping tasks with tags.
|
|
@ -371,7 +371,9 @@ class Block(Base, Conditional, CollectionSearch, Taggable):
|
||||||
tmp_list = []
|
tmp_list = []
|
||||||
for task in target:
|
for task in target:
|
||||||
if isinstance(task, Block):
|
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
|
elif (task.action == 'meta' or
|
||||||
(task.action == 'include' and task.evaluate_tags([], self._play.skip_tags, all_vars=all_vars)) 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)):
|
task.evaluate_tags(self._play.only_tags, self._play.skip_tags, all_vars=all_vars)):
|
||||||
|
|
Loading…
Reference in a new issue