Update source for reporting module_name
#78
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Ref: AGENT-11915
Return values from tasks haven't included a
module_name
field underinvocation
for probably a long time (this is not well documented by Ansible). This has caused themodule
tag key to always contain the valueundefined
. This seems to be the current reference on what the results dictionary is expected to contain.Even though I can't tell when this happened, I did find two references to this problem for an existing plugin:
I've based this fix on that PR, since Ansible documentation on what the objects passed to callbacks is rather sparse, and confirmed it to work. This has required to update existing callbacks to
v2_
callbacks (and I can't see any drawbacks for that), for which I've used https://github.com/ansible/ansible/blob/b5e0293645570f3f404ad1dbbe5f006956ada0df/lib/ansible/plugins/callback/__init__.py#L526-L527 and the like as a reference of how one converts to the other.I've also updated the
module_stdout
/module_stderr
references tostdout
/stderr
following existing docs and my own observation during manual testing.