fixes ANSIBLE_DUPLICATE_YAML_DICT_KEY=error crashes ()

* Fix 
This commit is contained in:
tavery321 2020-02-04 13:53:13 -05:00 committed by GitHub
parent 3b32f95fb3
commit 994a6b0c5a
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 7 additions and 1 deletions
changelogs/fragments
lib/ansible/parsing/yaml

View file

@ -0,0 +1,3 @@
bugfixes:
- DUPLICATE_YAML_DICT_KEY - Fix error output when configuration option DUPLICATE_YAML_DICT_KEY is set to error
(https://github.com/ansible/ansible/issues/65366)

View file

@ -76,7 +76,10 @@ class AnsibleConstructor(SafeConstructor):
if C.DUPLICATE_YAML_DICT_KEY == 'warn':
display.warning(msg)
elif C.DUPLICATE_YAML_DICT_KEY == 'error':
raise ConstructorError(to_native(msg))
raise ConstructorError(context=None, context_mark=None,
problem=to_native(msg),
problem_mark=node.start_mark,
note=None)
else:
# when 'ignore'
display.debug(msg)