|
|
|
|
@ -22,6 +22,7 @@ __metaclass__ = type
|
|
|
|
|
from yaml.constructor import SafeConstructor, ConstructorError
|
|
|
|
|
from yaml.nodes import MappingNode
|
|
|
|
|
|
|
|
|
|
from ansible import constants as C
|
|
|
|
|
from ansible.module_utils._text import to_bytes
|
|
|
|
|
from ansible.parsing.yaml.objects import AnsibleMapping, AnsibleSequence, AnsibleUnicode
|
|
|
|
|
from ansible.parsing.yaml.objects import AnsibleVaultEncryptedUnicode
|
|
|
|
|
@ -70,8 +71,9 @@ class AnsibleConstructor(SafeConstructor):
|
|
|
|
|
"found unacceptable key (%s)" % exc, key_node.start_mark)
|
|
|
|
|
|
|
|
|
|
if key in mapping:
|
|
|
|
|
display.warning(u'While constructing a mapping from {1}, line {2}, column {3}, found a duplicate dict key ({0}).'
|
|
|
|
|
u' Using last defined value only.'.format(key, *mapping.ansible_pos))
|
|
|
|
|
if C.DUPLICATE_DICT_KEY_WARNINGS:
|
|
|
|
|
display.warning(u'While constructing a mapping from {1}, line {2}, column {3}, found a duplicate dict key ({0}).'
|
|
|
|
|
u' Using last defined value only.'.format(key, *mapping.ansible_pos))
|
|
|
|
|
|
|
|
|
|
value = self.construct_object(value_node, deep=deep)
|
|
|
|
|
mapping[key] = value
|
|
|
|
|
|