Prevent rewriting nested Block's data in filter_tagged_tasks (#68337)

This patch fixes the issue where nested Block copies were created from
incorrect Block object. This resulted in nested Blocks data like ``name``
or ``_uuid`` to contain values from the Block the filter_tagged_tasks
method was called on.
This commit is contained in:
Martin Krizek 2020-04-21 09:36:35 +02:00 committed by GitHub
parent 122743ae30
commit cb389f6c31
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 4 additions and 1 deletions

View file

@ -0,0 +1,2 @@
bugfixes:
- Prevent rewriting nested Block's data in filter_tagged_tasks

View file

@ -379,7 +379,8 @@ class Block(Base, Conditional, CollectionSearch, Taggable):
return tmp_list return tmp_list
def evaluate_block(block): def evaluate_block(block):
new_block = self.copy(exclude_tasks=True) new_block = block.copy(exclude_parent=True, exclude_tasks=True)
new_block._parent = block._parent
new_block.block = evaluate_and_append_task(block.block) new_block.block = evaluate_and_append_task(block.block)
new_block.rescue = evaluate_and_append_task(block.rescue) new_block.rescue = evaluate_and_append_task(block.rescue)
new_block.always = evaluate_and_append_task(block.always) new_block.always = evaluate_and_append_task(block.always)