mirror of
https://github.com/ansible-collections/community.general.git
synced 2025-07-25 14:20:22 -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,11 +24,12 @@ import json
|
|||
import re
|
||||
import string
|
||||
import sys
|
||||
|
||||
from ansible.module_utils._text import to_bytes, to_text
|
||||
from ansible.module_utils.six import string_types
|
||||
from ansible.parsing.yaml.dumper import AnsibleDumper
|
||||
from ansible.plugins.callback import CallbackBase, strip_internal_keys
|
||||
from ansible.plugins.callback.default import CallbackModule as Default
|
||||
from ansible.module_utils.six import string_types
|
||||
from ansible.module_utils._text import to_bytes, to_text
|
||||
from ansible.parsing.yaml.dumper import AnsibleDumper
|
||||
|
||||
|
||||
# from http://stackoverflow.com/a/15423007/115478
|
||||
|
@ -81,7 +82,7 @@ class CallbackModule(Default):
|
|||
|
||||
def _dump_results(self, result, indent=None, sort_keys=True, keep_invocation=False):
|
||||
if result.get('_ansible_no_log', False):
|
||||
return json.dumps(dict(censored="the output has been hidden due to the fact that 'no_log: true' was specified for this result"))
|
||||
return json.dumps(dict(censored="The output has been hidden due to the fact that 'no_log: true' was specified for this result"))
|
||||
|
||||
# All result keys stating with _ansible_ are internal, so remove them from the result before we output anything.
|
||||
abridged_result = strip_internal_keys(result)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue