summaryrefslogtreecommitdiff
path: root/lib/ansible/plugins/inventory/toml.py
diff options
context:
space:
mode:
authorMatt Martz <matt@sivel.net>2020-08-17 13:46:13 -0500
committerGitHub <noreply@github.com>2020-08-17 13:46:13 -0500
commit9da880182be89a7fdbea3b5424da501542eba4c9 (patch)
treeea57356a841a0fe9c2b51a2cebe2ae2b158ae093 /lib/ansible/plugins/inventory/toml.py
parent959af7d90b34dfe530e27279db214ae2976c1f86 (diff)
downloadansible-9da880182be89a7fdbea3b5424da501542eba4c9.tar.gz
Allow the TOML inventory to dump unsafe. Fixes #71307 (#71309)
Diffstat (limited to 'lib/ansible/plugins/inventory/toml.py')
-rw-r--r--lib/ansible/plugins/inventory/toml.py3
1 files changed, 3 insertions, 0 deletions
diff --git a/lib/ansible/plugins/inventory/toml.py b/lib/ansible/plugins/inventory/toml.py
index 5d7ce31408..b4c8de1ce6 100644
--- a/lib/ansible/plugins/inventory/toml.py
+++ b/lib/ansible/plugins/inventory/toml.py
@@ -97,6 +97,7 @@ from ansible.module_utils.six import string_types, text_type
from ansible.parsing.yaml.objects import AnsibleSequence, AnsibleUnicode
from ansible.plugins.inventory import BaseFileInventoryPlugin
from ansible.utils.display import Display
+from ansible.utils.unsafe_proxy import AnsibleUnsafeBytes, AnsibleUnsafeText
try:
import toml
@@ -115,6 +116,8 @@ if HAS_TOML and hasattr(toml, 'TomlEncoder'):
self.dump_funcs.update({
AnsibleSequence: self.dump_funcs.get(list),
AnsibleUnicode: self.dump_funcs.get(str),
+ AnsibleUnsafeBytes: self.dump_funcs.get(str),
+ AnsibleUnsafeText: self.dump_funcs.get(str),
})
toml_dumps = partial(toml.dumps, encoder=AnsibleTomlEncoder())
else: