mirror of
https://github.com/ansible-collections/community.general.git
synced 2024-09-14 20:13:21 +02:00
Don't do parent stuff during serialize if squashed or finalized
This commit is contained in:
parent
cddf1cf98e
commit
9ecec6c28e
2 changed files with 11 additions and 11 deletions
|
@ -312,12 +312,7 @@ class Base(with_metaclass(BaseMeta, object)):
|
|||
'''
|
||||
if not self._squashed:
|
||||
for name in self._valid_attrs.keys():
|
||||
getter = partial(_generic_g, name)
|
||||
setter = partial(_generic_s, name)
|
||||
deleter = partial(_generic_d, name)
|
||||
|
||||
self._attributes[name] = getattr(self, name)
|
||||
#print("squashed attr %s: %s" % (name, self._attributes[name]))
|
||||
self._squashed = True
|
||||
|
||||
def copy(self):
|
||||
|
@ -516,7 +511,9 @@ class Base(with_metaclass(BaseMeta, object)):
|
|||
repr[name] = getattr(self, name)
|
||||
|
||||
# serialize the uuid field
|
||||
repr['uuid'] = getattr(self, '_uuid')
|
||||
repr['uuid'] = self._uuid
|
||||
repr['finalized'] = self._finalized
|
||||
repr['squashed'] = self._squashed
|
||||
|
||||
return repr
|
||||
|
||||
|
@ -538,4 +535,6 @@ class Base(with_metaclass(BaseMeta, object)):
|
|||
|
||||
# restore the UUID field
|
||||
setattr(self, '_uuid', data.get('uuid'))
|
||||
self._finalized = data.get('finalized', False)
|
||||
self._squashed = data.get('squashed', False)
|
||||
|
||||
|
|
|
@ -342,6 +342,7 @@ class Task(Base, Conditional, Taggable, Become):
|
|||
def serialize(self):
|
||||
data = super(Task, self).serialize()
|
||||
|
||||
if not self._squashed and not self._finalized:
|
||||
if self._parent:
|
||||
data['parent'] = self._parent.serialize()
|
||||
data['parent_type'] = self._parent.__class__.__name__
|
||||
|
|
Loading…
Reference in a new issue