summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorToshio Kuratomi <toshio@fedoraproject.org>2015-10-22 08:25:20 -0700
committerToshio Kuratomi <toshio@fedoraproject.org>2015-10-22 08:53:37 -0700
commit6b6d03290a783690624ebad60d03322421af7827 (patch)
tree91939ed3ad2a59374f1341fc704ed30794d5746b
parent498c27d09a5b8682a88fe1801050ba7355f1e561 (diff)
downloadansible-6b6d03290a783690624ebad60d03322421af7827.tar.gz
Restore the automatic addition of invocation to the output
Revert "Remove auto-added invocation return value as it is not used by v2 and could leak sensitive data." This reverts commit 6ce6b202684e35313deea54f89bbb8e40e48cc79. Remove the note that invocation was removed as we've now restored it. Revert "keyword not in ubuntu 14.04" This reverts commit 5c016224570fc9d68f9e3d02ed8b0d4999d20457. Revert "remove invocation keyword check" This reverts commit 5177cb3f746caa104bf8e29e3469b5682d466534.
-rw-r--r--CHANGELOG.md1
-rw-r--r--lib/ansible/plugins/action/__init__.py7
-rw-r--r--lib/ansible/plugins/callback/log_plays.py3
-rw-r--r--test/integration/roles/test_apt/tasks/apt.yml1
-rw-r--r--test/integration/roles/test_yum/tasks/yum.yml1
5 files changed, 12 insertions, 1 deletions
diff --git a/CHANGELOG.md b/CHANGELOG.md
index 9fc63db9fe..bc5b59571b 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -301,7 +301,6 @@ you avoid ever writing sensitive plaintext to disk.
* Configuration items defined as paths (local only) now all support shell style interpolations.
* Many fixes and new options added to modules, too many to list here.
* Now you can see task file and line number when using verbosity of 3 or above.
-* Removed the automatically added invocation field from output of modules. It's no longer needed by the code.
## 1.9.4 "Dancing In the Street" - Oct 9, 2015
diff --git a/lib/ansible/plugins/action/__init__.py b/lib/ansible/plugins/action/__init__.py
index 561763696d..6e3cb6f3f8 100644
--- a/lib/ansible/plugins/action/__init__.py
+++ b/lib/ansible/plugins/action/__init__.py
@@ -441,6 +441,13 @@ class ActionBase:
if 'stdout' in data and 'stdout_lines' not in data:
data['stdout_lines'] = data.get('stdout', u'').splitlines()
+ # store the module invocation details back into the result
+ if self._task.async != 0:
+ data['invocation'] = dict(
+ module_args = module_args,
+ module_name = module_name,
+ )
+
self._display.debug("done with _execute_module (%s, %s)" % (module_name, module_args))
return data
diff --git a/lib/ansible/plugins/callback/log_plays.py b/lib/ansible/plugins/callback/log_plays.py
index d8a834cadc..f816951fe7 100644
--- a/lib/ansible/plugins/callback/log_plays.py
+++ b/lib/ansible/plugins/callback/log_plays.py
@@ -58,7 +58,10 @@ class CallbackModule(CallbackBase):
data = 'omitted'
else:
data = data.copy()
+ invocation = data.pop('invocation', None)
data = json.dumps(data)
+ if invocation is not None:
+ data = json.dumps(invocation) + " => %s " % data
path = os.path.join("/var/log/ansible/hosts", host)
now = time.strftime(self.TIME_FORMAT, time.localtime())
diff --git a/test/integration/roles/test_apt/tasks/apt.yml b/test/integration/roles/test_apt/tasks/apt.yml
index 5d331b192d..c02a1bd4a0 100644
--- a/test/integration/roles/test_apt/tasks/apt.yml
+++ b/test/integration/roles/test_apt/tasks/apt.yml
@@ -63,6 +63,7 @@
- name: verify apt module outputs
assert:
that:
+ - "'invocation' in apt_result"
- "'changed' in apt_result"
- "'stderr' in apt_result"
- "'stdout' in apt_result"
diff --git a/test/integration/roles/test_yum/tasks/yum.yml b/test/integration/roles/test_yum/tasks/yum.yml
index 95b4477739..923717552b 100644
--- a/test/integration/roles/test_yum/tasks/yum.yml
+++ b/test/integration/roles/test_yum/tasks/yum.yml
@@ -67,6 +67,7 @@
- name: verify yum module outputs
assert:
that:
+ - "'invocation' in yum_result"
- "'changed' in yum_result"
- "'msg' in yum_result"
- "'rc' in yum_result"