|
|
@ -1215,6 +1215,25 @@ def to_unicode(value):
|
|
|
|
return value
|
|
|
|
return value
|
|
|
|
return value.decode("utf-8")
|
|
|
|
return value.decode("utf-8")
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
def json_dict_unicode_to_bytes(d):
|
|
|
|
|
|
|
|
''' Recursively convert dict keys and values to byte str
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Specialized for json return because this only handles, lists, tuples,
|
|
|
|
|
|
|
|
and dict container types (the containers that the json module returns)
|
|
|
|
|
|
|
|
'''
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if isinstance(d, unicode):
|
|
|
|
|
|
|
|
return d.encode('utf-8')
|
|
|
|
|
|
|
|
elif isinstance(d, dict):
|
|
|
|
|
|
|
|
return dict(map(json_dict_unicode_to_bytes, d.iteritems()))
|
|
|
|
|
|
|
|
elif isinstance(d, list):
|
|
|
|
|
|
|
|
return list(map(json_dict_unicode_to_bytes, d))
|
|
|
|
|
|
|
|
elif isinstance(d, tuple):
|
|
|
|
|
|
|
|
return tuple(map(json_dict_unicode_to_bytes, d))
|
|
|
|
|
|
|
|
else:
|
|
|
|
|
|
|
|
return d
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
def get_diff(diff):
|
|
|
|
def get_diff(diff):
|
|
|
|
# called by --diff usage in playbook and runner via callbacks
|
|
|
|
# called by --diff usage in playbook and runner via callbacks
|
|
|
|
# include names in diffs 'before' and 'after' and do diff -U 10
|
|
|
|
# include names in diffs 'before' and 'after' and do diff -U 10
|
|
|
|