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:
James Cammarata 2015-09-08 12:18:10 -04:00
commit 30399edada
4 changed files with 37 additions and 5 deletions

View file

@ -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