mirror of
https://github.com/ansible-collections/community.general.git
synced 2025-04-24 11:21:25 -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
|
@ -291,7 +291,15 @@ class TaskExecutor:
|
|||
templar = Templar(loader=self._loader, shared_loader_obj=self._shared_loader_obj, variables=self._job_vars)
|
||||
res['_ansible_item_label'] = templar.template(label)
|
||||
|
||||
self._rslt_q.put(TaskResult(self._host.name, self._task._uuid, res), block=False)
|
||||
self._rslt_q.put(
|
||||
TaskResult(
|
||||
self._host.name,
|
||||
self._task._uuid,
|
||||
res,
|
||||
task_fields=self._task.dump_attrs(),
|
||||
),
|
||||
block=False,
|
||||
)
|
||||
results.append(res)
|
||||
del task_vars[loop_var]
|
||||
|
||||
|
@ -565,7 +573,7 @@ class TaskExecutor:
|
|||
result['_ansible_retry'] = True
|
||||
result['retries'] = retries
|
||||
display.debug('Retrying task, attempt %d of %d' % (attempt, retries))
|
||||
self._rslt_q.put(TaskResult(self._host.name, self._task._uuid, result), block=False)
|
||||
self._rslt_q.put(TaskResult(self._host.name, self._task._uuid, result, task_fields=self._task.dump_attrs()), block=False)
|
||||
time.sleep(delay)
|
||||
else:
|
||||
if retries > 1:
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue