mirror of
https://github.com/ansible-collections/community.general.git
synced 2025-07-26 06:31: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
|
@ -28,14 +28,20 @@ class TaskResult:
|
|||
the result of a given task.
|
||||
'''
|
||||
|
||||
def __init__(self, host, task, return_data):
|
||||
def __init__(self, host, task, return_data, task_fields=None):
|
||||
self._host = host
|
||||
self._task = task
|
||||
|
||||
if isinstance(return_data, dict):
|
||||
self._result = return_data.copy()
|
||||
else:
|
||||
self._result = DataLoader().load(return_data)
|
||||
|
||||
if task_fields is None:
|
||||
self._task_fields = dict()
|
||||
else:
|
||||
self._task_fields = task_fields
|
||||
|
||||
def is_changed(self):
|
||||
return self._check_key('changed')
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue