From 8c43ce491e4ff62c0c6cca83398e7ab7e9ec2310 Mon Sep 17 00:00:00 2001 From: Brian Coca Date: Wed, 28 Nov 2018 14:37:03 -0500 Subject: [PATCH] unsafe cleanup --- changelogs/fragments/unsafe_cleanup.yml | 2 ++ lib/ansible/parsing/yaml/constructor.py | 7 ++----- 2 files changed, 4 insertions(+), 5 deletions(-) create mode 100644 changelogs/fragments/unsafe_cleanup.yml diff --git a/changelogs/fragments/unsafe_cleanup.yml b/changelogs/fragments/unsafe_cleanup.yml new file mode 100644 index 0000000000..350e07e754 --- /dev/null +++ b/changelogs/fragments/unsafe_cleanup.yml @@ -0,0 +1,2 @@ +bugfixes: + - small code cleanup to make method signatures match their parents and nicer 'unsafe' handling. diff --git a/lib/ansible/parsing/yaml/constructor.py b/lib/ansible/parsing/yaml/constructor.py index b6b4a3e7b8..1483db814b 100644 --- a/lib/ansible/parsing/yaml/constructor.py +++ b/lib/ansible/parsing/yaml/constructor.py @@ -78,7 +78,7 @@ class AnsibleConstructor(SafeConstructor): return mapping - def construct_yaml_str(self, node, unsafe=False): + def construct_yaml_str(self, node): # Override the default string handling function # to always return unicode objects value = self.construct_scalar(node) @@ -86,9 +86,6 @@ class AnsibleConstructor(SafeConstructor): ret.ansible_pos = self._node_position_info(node) - if unsafe: - ret = wrap_var(ret) - return ret def construct_vault_encrypted_unicode(self, node): @@ -113,7 +110,7 @@ class AnsibleConstructor(SafeConstructor): data.ansible_pos = self._node_position_info(node) def construct_yaml_unsafe(self, node): - return self.construct_yaml_str(node, unsafe=True) + return wrap_var(self.construct_yaml_str(node)) def _node_position_info(self, node): # the line number where the previous token has ended (plus empty lines)