mirror of
https://github.com/ansible-collections/community.general.git
synced 2025-04-26 20:31:27 -07:00
Correctly reassign implicit block parents when an include is involved
This commit is contained in:
parent
32a7b4ce71
commit
7ff9942ec6
1 changed files with 6 additions and 1 deletions
|
@ -40,6 +40,8 @@ def load_list_of_blocks(ds, play, parent_block=None, role=None, task_include=Non
|
||||||
|
|
||||||
# we import here to prevent a circular dependency with imports
|
# we import here to prevent a circular dependency with imports
|
||||||
from ansible.playbook.block import Block
|
from ansible.playbook.block import Block
|
||||||
|
from ansible.playbook.task_include import TaskInclude
|
||||||
|
from ansible.playbook.role_include import IncludeRole
|
||||||
|
|
||||||
assert isinstance(ds, (list, type(None)))
|
assert isinstance(ds, (list, type(None)))
|
||||||
|
|
||||||
|
@ -61,7 +63,10 @@ def load_list_of_blocks(ds, play, parent_block=None, role=None, task_include=Non
|
||||||
# squash them down to a single block to save processing time later.
|
# squash them down to a single block to save processing time later.
|
||||||
if b._implicit and len(block_list) > 0 and block_list[-1]._implicit:
|
if b._implicit and len(block_list) > 0 and block_list[-1]._implicit:
|
||||||
for t in b.block:
|
for t in b.block:
|
||||||
t._parent = block_list[-1]
|
if isinstance(t._parent, (TaskInclude, IncludeRole)):
|
||||||
|
t._parent._parent = block_list[-1]
|
||||||
|
else:
|
||||||
|
t._parent = block_list[-1]
|
||||||
block_list[-1].block.extend(b.block)
|
block_list[-1].block.extend(b.block)
|
||||||
else:
|
else:
|
||||||
block_list.append(b)
|
block_list.append(b)
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue