mirror of
https://github.com/ansible-collections/community.general.git
synced 2025-10-10 18:34:03 -07:00
use ansible json encoder for results in callbacks (#46830)
* use ansible json encoder for results in callbacks
This commit is contained in:
parent
ade5d938c3
commit
643ff29d2d
6 changed files with 18 additions and 13 deletions
|
@ -24,6 +24,7 @@ import json
|
|||
|
||||
from ansible.module_utils._text import to_bytes
|
||||
from ansible.module_utils.common._collections_compat import MutableMapping
|
||||
from ansible.parsing.ajson import AnsibleJSONEncoder
|
||||
from ansible.plugins.callback import CallbackBase
|
||||
|
||||
|
||||
|
@ -61,7 +62,7 @@ class CallbackModule(CallbackBase):
|
|||
else:
|
||||
data = data.copy()
|
||||
invocation = data.pop('invocation', None)
|
||||
data = json.dumps(data)
|
||||
data = json.dumps(data, cls=AnsibleJSONEncoder)
|
||||
if invocation is not None:
|
||||
data = json.dumps(invocation) + " => %s " % data
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue