Add representer to AnsibleDumper for AnsibleUnsafeText

Fixes #20253
Fixes #20290
This commit is contained in:
James Cammarata 2017-01-18 19:35:24 -06:00
parent 75a7ebe900
commit ec14572a60

View file

@ -25,6 +25,7 @@ from ansible.compat.six import PY3
from ansible.parsing.yaml.objects import AnsibleUnicode, AnsibleSequence, AnsibleMapping from ansible.parsing.yaml.objects import AnsibleUnicode, AnsibleSequence, AnsibleMapping
from ansible.parsing.yaml.objects import AnsibleVaultEncryptedUnicode from ansible.parsing.yaml.objects import AnsibleVaultEncryptedUnicode
from ansible.vars.hostvars import HostVars from ansible.vars.hostvars import HostVars
from ansible.vars.unsafe_proxy import AnsibleUnsafeText
class AnsibleDumper(yaml.SafeDumper): class AnsibleDumper(yaml.SafeDumper):
@ -51,6 +52,11 @@ AnsibleDumper.add_representer(
represent_unicode, represent_unicode,
) )
AnsibleDumper.add_representer(
AnsibleUnsafeText,
represent_unicode,
)
AnsibleDumper.add_representer( AnsibleDumper.add_representer(
HostVars, HostVars,
represent_hostvars, represent_hostvars,