|
|
@ -47,13 +47,19 @@ UUID_NAMESPACE_ANSIBLE = uuid.UUID('361E6D51-FAEC-444A-9079-341386DA8E2E')
|
|
|
|
def to_yaml(a, *args, **kw):
|
|
|
|
def to_yaml(a, *args, **kw):
|
|
|
|
'''Make verbose, human readable yaml'''
|
|
|
|
'''Make verbose, human readable yaml'''
|
|
|
|
default_flow_style = kw.pop('default_flow_style', None)
|
|
|
|
default_flow_style = kw.pop('default_flow_style', None)
|
|
|
|
transformed = yaml.dump(a, Dumper=AnsibleDumper, allow_unicode=True, default_flow_style=default_flow_style, **kw)
|
|
|
|
try:
|
|
|
|
|
|
|
|
transformed = yaml.dump(a, Dumper=AnsibleDumper, allow_unicode=True, default_flow_style=default_flow_style, **kw)
|
|
|
|
|
|
|
|
except Exception as e:
|
|
|
|
|
|
|
|
raise AnsibleFilterError("to_yaml - %s" % to_native(e), orig_exc=e)
|
|
|
|
return to_text(transformed)
|
|
|
|
return to_text(transformed)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
def to_nice_yaml(a, indent=4, *args, **kw):
|
|
|
|
def to_nice_yaml(a, indent=4, *args, **kw):
|
|
|
|
'''Make verbose, human readable yaml'''
|
|
|
|
'''Make verbose, human readable yaml'''
|
|
|
|
transformed = yaml.dump(a, Dumper=AnsibleDumper, indent=indent, allow_unicode=True, default_flow_style=False, **kw)
|
|
|
|
try:
|
|
|
|
|
|
|
|
transformed = yaml.dump(a, Dumper=AnsibleDumper, indent=indent, allow_unicode=True, default_flow_style=False, **kw)
|
|
|
|
|
|
|
|
except Exception as e:
|
|
|
|
|
|
|
|
raise AnsibleFilterError("to_nice_yaml - %s" % to_native(e), orig_exc=e)
|
|
|
|
return to_text(transformed)
|
|
|
|
return to_text(transformed)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|