mirror of
https://github.com/ansible-collections/community.general.git
synced 2025-06-01 13:59:09 -07:00
avoid persistent containers in attribute defaults
moved from the field attribute declaration and created a placeholder which then is resolved in the field attribute class. this is to avoid unwanted persistent of the defaults across objects which introduces stealth bugs when multiple objects of the same kind are used in succession while not overriding the default values.
This commit is contained in:
parent
0719eb3e2d
commit
87969868d4
9 changed files with 29 additions and 18 deletions
|
@ -33,7 +33,7 @@ class Conditional:
|
|||
to be run conditionally when a condition is met or skipped.
|
||||
'''
|
||||
|
||||
_when = FieldAttribute(isa='list', default=[])
|
||||
_when = FieldAttribute(isa='list', default='_ansible_container')
|
||||
|
||||
def __init__(self, loader=None):
|
||||
# when used directly, this class needs a loader, but we want to
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue