mirror of
https://github.com/ansible-collections/community.general.git
synced 2025-07-27 15:11:23 -07:00
Use UnsafeProxy for lookup results too
Also fixes a couple of bugs that popped up when using the proxy class
This commit is contained in:
parent
f0411217e6
commit
30399edada
4 changed files with 37 additions and 5 deletions
|
@ -128,3 +128,14 @@ 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