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 6ce6b20268.

Remove the note that invocation was removed as we've now restored it.

Revert "keyword not in ubuntu 14.04"

This reverts commit 5c01622457.

Revert "remove invocation keyword check"

This reverts commit 5177cb3f74.
This commit is contained in:
Toshio Kuratomi 2015-10-22 08:25:20 -07:00
parent 498c27d09a
commit 6b6d03290a
5 changed files with 12 additions and 1 deletions

View file

@ -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. * 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. * 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. * 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 ## 1.9.4 "Dancing In the Street" - Oct 9, 2015

View file

@ -441,6 +441,13 @@ class ActionBase:
if 'stdout' in data and 'stdout_lines' not in data: if 'stdout' in data and 'stdout_lines' not in data:
data['stdout_lines'] = data.get('stdout', u'').splitlines() 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)) self._display.debug("done with _execute_module (%s, %s)" % (module_name, module_args))
return data return data

View file

@ -58,7 +58,10 @@ class CallbackModule(CallbackBase):
data = 'omitted' data = 'omitted'
else: else:
data = data.copy() data = data.copy()
invocation = data.pop('invocation', None)
data = json.dumps(data) data = json.dumps(data)
if invocation is not None:
data = json.dumps(invocation) + " => %s " % data
path = os.path.join("/var/log/ansible/hosts", host) path = os.path.join("/var/log/ansible/hosts", host)
now = time.strftime(self.TIME_FORMAT, time.localtime()) now = time.strftime(self.TIME_FORMAT, time.localtime())

View file

@ -63,6 +63,7 @@
- name: verify apt module outputs - name: verify apt module outputs
assert: assert:
that: that:
- "'invocation' in apt_result"
- "'changed' in apt_result" - "'changed' in apt_result"
- "'stderr' in apt_result" - "'stderr' in apt_result"
- "'stdout' in apt_result" - "'stdout' in apt_result"

View file

@ -67,6 +67,7 @@
- name: verify yum module outputs - name: verify yum module outputs
assert: assert:
that: that:
- "'invocation' in yum_result"
- "'changed' in yum_result" - "'changed' in yum_result"
- "'msg' in yum_result" - "'msg' in yum_result"
- "'rc' in yum_result" - "'rc' in yum_result"