mirror of
https://github.com/ansible-collections/community.general.git
synced 2025-07-27 15:11:23 -07:00
Stash post-validated fields of the task in the TaskResult
This allows us to have a snapshot of the fields, which we can restore on the pre-fork side so as to avoid having to re-template fields.
This commit is contained in:
parent
40235d7b99
commit
3d65482927
5 changed files with 54 additions and 26 deletions
|
@ -500,6 +500,15 @@ class Base(with_metaclass(BaseMeta, object)):
|
|||
|
||||
return [i for i,_ in itertools.groupby(combined) if i is not None]
|
||||
|
||||
def dump_attrs(self):
|
||||
'''
|
||||
Dumps all attributes to a dictionary
|
||||
'''
|
||||
attrs = dict()
|
||||
for name in self._valid_attrs.keys():
|
||||
attrs[name] = getattr(self, name)
|
||||
return attrs
|
||||
|
||||
def serialize(self):
|
||||
'''
|
||||
Serializes the object derived from the base object into
|
||||
|
@ -509,10 +518,7 @@ class Base(with_metaclass(BaseMeta, object)):
|
|||
as field attributes.
|
||||
'''
|
||||
|
||||
repr = dict()
|
||||
|
||||
for name in self._valid_attrs.keys():
|
||||
repr[name] = getattr(self, name)
|
||||
repr = self.dump_attrs()
|
||||
|
||||
# serialize the uuid field
|
||||
repr['uuid'] = self._uuid
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue