From 92dd563a7591fa81058c51e0585d7cdbab7ccafc Mon Sep 17 00:00:00 2001 From: Toshio Kuratomi Date: Sat, 24 Oct 2015 07:28:02 -0700 Subject: [PATCH] Fix invocation from bad merge and note where it would need to go to keep it out of registered vars as well. --- lib/ansible/executor/task_executor.py | 8 +++++++- lib/ansible/plugins/callback/__init__.py | 5 +---- 2 files changed, 8 insertions(+), 5 deletions(-) diff --git a/lib/ansible/executor/task_executor.py b/lib/ansible/executor/task_executor.py index 3427ab6a84..e8a785a02c 100644 --- a/lib/ansible/executor/task_executor.py +++ b/lib/ansible/executor/task_executor.py @@ -365,7 +365,7 @@ class TaskExecutor: # update the local copy of vars with the registered value, if specified, # or any facts which may have been generated by the module execution if self._task.register: - vars_copy[self._task.register] = result + vars_copy[self._task.register] = result if 'ansible_facts' in result: vars_copy.update(result['ansible_facts']) @@ -412,6 +412,12 @@ class TaskExecutor: # do the final update of the local variables here, for both registered # values and any facts which may have been created if self._task.register: + ### FIXME: + # If we remove invocation, we should also be removing _ansible* + # and maybe ansible_facts. + # Remove invocation from registered vars + #if 'invocation' in result: + # del result['invocation'] variables[self._task.register] = result if 'ansible_facts' in result: diff --git a/lib/ansible/plugins/callback/__init__.py b/lib/ansible/plugins/callback/__init__.py index 3ad3c78f46..612266a9f7 100644 --- a/lib/ansible/plugins/callback/__init__.py +++ b/lib/ansible/plugins/callback/__init__.py @@ -68,11 +68,8 @@ class CallbackBase: keep_invocation = False else: keep_invocation = True - if not keep_invocation and 'invocation' in result: - del abridged_result['invocation'] - # remove invocation info unless its very very verbose - if 'invocation' in abridged_result and self._display.verbosity < 3: + if not keep_invocation and 'invocation' in result: del abridged_result['invocation'] return json.dumps(abridged_result, indent=indent, ensure_ascii=False, sort_keys=sort_keys)