mirror of
https://github.com/ansible-collections/community.general.git
synced 2026-05-07 22:02:50 +00:00
Fix redundant yaml error blurbs on ModArgs parse errors (#36923)
* Fix redundant yaml error blurbs on ModArgs parse errors Some of the AnsibleParserErrors from parsing.mod_args are created with the obj=some_yaml_ds options but some are not. If they were, we don't want to add another yaml_ds to it, because that will result in double yaml error blurbs. And since we dont need to add info, we can just re raise it. But if there is no ._obj, add it here so we get the extra detail in the error message (see issue #14790) and raise a new AnsibleParserError instance. Fixes #36848 * cleanup existing test_tasks pep8/sanity issues
This commit is contained in:
committed by
Brian Coca
parent
6281441e4d
commit
e166946a0a
@@ -184,6 +184,11 @@ class Task(Base, Conditional, Taggable, Become):
|
||||
try:
|
||||
(action, args, delegate_to) = args_parser.parse()
|
||||
except AnsibleParserError as e:
|
||||
# if the raises exception was created with obj=ds args, then it includes the detail
|
||||
# so we dont need to add it so we can just re raise.
|
||||
if e._obj:
|
||||
raise
|
||||
# But if it wasn't, we can add the yaml object now to get more detail
|
||||
raise AnsibleParserError(to_native(e), obj=ds, orig_exc=e)
|
||||
|
||||
# the command/shell/script modules used to support the `cmd` arg,
|
||||
|
||||
Reference in New Issue
Block a user