mirror of
https://github.com/ansible-collections/community.general.git
synced 2025-10-04 15:34:01 -07:00
Revert "avoid persistent containers in attribute defaults"
This reverts commit 87969868d4
.
found better way to do it
This commit is contained in:
parent
332a008273
commit
c64298de02
9 changed files with 18 additions and 29 deletions
|
@ -32,17 +32,6 @@ class Attribute:
|
|||
self.priority = priority
|
||||
self.always_post_validate = always_post_validate
|
||||
|
||||
# This is here to avoid `default=<container>` unwanted persistence across object instances
|
||||
# We cannot rely on None as some fields use it to skip the code
|
||||
# that would detect an empty container as a user error
|
||||
if self.default == '_ansible_container':
|
||||
if self.isa == 'list':
|
||||
self.default = []
|
||||
elif self.isa == 'dict':
|
||||
self.default = {}
|
||||
elif self.isa == 'set':
|
||||
self.default = set()
|
||||
|
||||
def __eq__(self, other):
|
||||
return other.priority == self.priority
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue