diff --git a/changelogs/fragments/nativejinjaunsafetext-yaml-representer.yml b/changelogs/fragments/nativejinjaunsafetext-yaml-representer.yml new file mode 100644 index 00000000000..e13486fb309 --- /dev/null +++ b/changelogs/fragments/nativejinjaunsafetext-yaml-representer.yml @@ -0,0 +1,2 @@ +bugfixes: + - Add a YAML representer for ``NativeJinjaUnsafeText`` diff --git a/lib/ansible/parsing/yaml/dumper.py b/lib/ansible/parsing/yaml/dumper.py index 65d35781f79..170b37cb7de 100644 --- a/lib/ansible/parsing/yaml/dumper.py +++ b/lib/ansible/parsing/yaml/dumper.py @@ -24,7 +24,7 @@ import yaml from ansible.module_utils.six import text_type, binary_type from ansible.module_utils.common.yaml import SafeDumper from ansible.parsing.yaml.objects import AnsibleUnicode, AnsibleSequence, AnsibleMapping, AnsibleVaultEncryptedUnicode -from ansible.utils.unsafe_proxy import AnsibleUnsafeText, AnsibleUnsafeBytes +from ansible.utils.unsafe_proxy import AnsibleUnsafeText, AnsibleUnsafeBytes, NativeJinjaUnsafeText from ansible.template import AnsibleUndefined from ansible.vars.hostvars import HostVars, HostVarsVars from ansible.vars.manager import VarsWithSources @@ -110,3 +110,8 @@ AnsibleDumper.add_representer( AnsibleUndefined, represent_undefined, ) + +AnsibleDumper.add_representer( + NativeJinjaUnsafeText, + represent_unicode, +)