mirror of
https://github.com/ansible-collections/community.general.git
synced 2025-07-27 23:21:22 -07:00
Remove custom json encoder cleaner and strip proxy var stuff out before encoding
Fixes #12349
This commit is contained in:
parent
a431121f9f
commit
cc6627cdd6
2 changed files with 15 additions and 14 deletions
|
@ -20,6 +20,7 @@ from __future__ import (absolute_import, division, print_function)
|
|||
__metaclass__ = type
|
||||
|
||||
import ast
|
||||
from json import JSONEncoder
|
||||
from collections import MutableMapping
|
||||
|
||||
from six import iteritems, string_types
|
||||
|
@ -128,14 +129,3 @@ def isidentifier(ident):
|
|||
|
||||
return True
|
||||
|
||||
def json_variable_cleaner(obj):
|
||||
'''
|
||||
Used as the default= parameter to json.dumps(), this method helps
|
||||
clear out UnsafeProxy variables so they can be properly JSON encoded
|
||||
'''
|
||||
from ansible.vars.unsafe_proxy import UnsafeProxy
|
||||
if isinstance(obj, UnsafeProxy):
|
||||
return obj._obj
|
||||
else:
|
||||
return obj
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue