mirror of
https://github.com/ansible-collections/community.general.git
synced 2025-06-01 05:49:09 -07:00
Don't copy the parent block of TaskIncludes when loading statically
When loading an include statically, we previously were simply doing a copy() of the TaskInclude object, which recurses up the parents creating a new lineage of objects. This caused problems when used inside load_list_of_blocks as the new parent Block of the new TaskInclude was not actually in the list of blocks being operated on. In most circumstances, this did not cause a problem as the new parent block was a proper copy, however when used in combination with PlaybookInclude (which copies conditionals to the list of blocks loaded) this untracked parent was not being properly updated, leading to tasks being run improperly. Fixes #18206
This commit is contained in:
parent
b17149f3bf
commit
5b87951d6c
7 changed files with 27 additions and 36 deletions
|
@ -51,6 +51,17 @@ class Conditional:
|
|||
if not isinstance(value, list):
|
||||
setattr(self, name, [ value ])
|
||||
|
||||
def _get_attr_when(self):
|
||||
'''
|
||||
Override for the 'tags' getattr fetcher, used from Base.
|
||||
'''
|
||||
when = self._attributes['when']
|
||||
if when is None:
|
||||
when = []
|
||||
if hasattr(self, '_get_parent_attribute'):
|
||||
when = self._get_parent_attribute('when', extend=True)
|
||||
return when
|
||||
|
||||
def evaluate_conditional(self, templar, all_vars):
|
||||
'''
|
||||
Loops through the conditionals set on this object, returning
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue