mirror of
https://github.com/ansible-collections/community.general.git
synced 2025-07-24 22:00:22 -07:00
Fix nonexistent module_name in callbacks (#23587)
This commit is contained in:
parent
b8507b676b
commit
7c308b3f8c
2 changed files with 3 additions and 5 deletions
|
@ -189,10 +189,8 @@ class CallbackModule(CallbackBase):
|
||||||
|
|
||||||
def v2_runner_on_ok(self, result):
|
def v2_runner_on_ok(self, result):
|
||||||
res = result._result
|
res = result._result
|
||||||
try:
|
module = result._task.action
|
||||||
module = res['invocation']['module_name']
|
|
||||||
except KeyError:
|
|
||||||
module = None
|
|
||||||
if module == 'setup':
|
if module == 'setup':
|
||||||
host = result._host.get_name()
|
host = result._host.get_name()
|
||||||
self.send_facts(host, res)
|
self.send_facts(host, res)
|
||||||
|
|
|
@ -87,7 +87,7 @@ class CallbackModule(CallbackBase):
|
||||||
sender = '"Ansible: %s" <root>' % host
|
sender = '"Ansible: %s" <root>' % host
|
||||||
attach = res._task.action
|
attach = res._task.action
|
||||||
if 'invocation' in res._result:
|
if 'invocation' in res._result:
|
||||||
attach = "%s: %s" % (res._result['invocation']['module_name'], json.dumps(res._result['invocation']['module_args']))
|
attach = "%s: %s" % (res._task.action, json.dumps(res._result['invocation']['module_args']))
|
||||||
|
|
||||||
subject = 'Failed: %s' % attach
|
subject = 'Failed: %s' % attach
|
||||||
body = 'The following task failed for host ' + host + ':\n\n%s\n\n' % attach
|
body = 'The following task failed for host ' + host + ':\n\n%s\n\n' % attach
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue