mirror of
https://github.com/ansible-collections/community.general.git
synced 2026-05-07 05:42:50 +00:00
Fixing template integration test for python 2.6 versions
No longer immediately fallback to to_json if simplejson is not installed
This commit is contained in:
@@ -100,9 +100,11 @@ def to_nice_json(a, *args, **kw):
|
||||
else:
|
||||
if major >= 2:
|
||||
return simplejson.dumps(a, indent=4, sort_keys=True, *args, **kw)
|
||||
try:
|
||||
return json.dumps(a, indent=4, sort_keys=True, cls=AnsibleJSONEncoder, *args, **kw)
|
||||
except:
|
||||
# Fallback to the to_json filter
|
||||
return to_json(a, *args, **kw)
|
||||
return json.dumps(a, indent=4, sort_keys=True, cls=AnsibleJSONEncoder, *args, **kw)
|
||||
|
||||
def bool(a):
|
||||
''' return a bool for the arg '''
|
||||
|
||||
Reference in New Issue
Block a user