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:
James Cammarata 2017-02-17 09:14:26 -06:00
commit 3d65482927
5 changed files with 54 additions and 26 deletions

View file

@ -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')