mirror of
https://github.com/ansible-collections/community.general.git
synced 2026-05-07 05:42:50 +00: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:
@@ -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')
|
||||
|
||||
|
||||
Reference in New Issue
Block a user