Commit Graph

15 Commits (d0d2beafbac744c0ddc7e9527ffed0d532301747)

Author SHA1 Message Date
Adrian Likins 4befefd78c Try to show original exception info for yaml (and other) errors (#24468)
* show original exception for yaml (and other) errors

In places where we need to catch a yaml error and raise
an AnsibleError, add the orig yaml exc to the AnsibleError
via the orig_exc arg.

When the AnsibleError is displayed it will now include the
AnsibleError (AnsibleParserError for example) and the type
and message from the original yaml exception.

This provides more detail to the error messages related to
yaml errors.

This also improves errors from dataloader (for example,
previously if a wrong password was used for a vault encrypted
yaml file, the error was very vague and suggested yaml errors,
but now the message includes the original exception from vault
indicating the password was incorrect or missing).

Add a text note to playbook helper asserts. For playbook
syntax/layout errors that aren't yaml errors, but errors
indicating invalid data structures for a playbook/task/role/block,
we now include some info about where the assert was and
why it was raised.

In places we raise an AnsibleParserError in an except
clause, pass the original exception to AnsibleParserError via
orig_exc arg.

Make assorted error messages a little more specific (like
the playbook helper load methods)

* Revert "Include the original YAML error in syntax error messages"

This reverts commit 781bb44b02.
2017-06-09 13:13:15 -04:00
Dag Wieers 6f6bdf7914 ansible/parsing: PEP8 compliancy (#24701)
- Make PEP8 compliant
2017-05-18 18:41:00 +01:00
Toshio Kuratomi 4ed88512e4 Move uses of to_bytes, to_text, to_native to use the module_utils version (#17423)
We couldn't copy to_unicode, to_bytes, to_str into module_utils because
of licensing.  So once created it we had two sets of functions that did
the same things but had different implementations.  To remedy that, this
change removes the ansible.utils.unicode versions of those functions.
2016-09-06 22:54:17 -07:00
James Cammarata f2713f764c Take previous jinja2 blocks into account in splitter when we see quotes
Previously, split_args() was not taking print/block/comment depth into account
when splitting things, meaning that if there was a quote character inside an
un-quoted variable (ie. {{ foo | some_filter(' ') }}), it was incorrectly
splitting on the quotes instead of continuing to append to the previous param.

Fixes #13630
2016-03-28 15:43:43 -04:00
Konstantin Suvorov 1c922135a0 show error context in args splitter exception 2016-03-24 16:50:21 +03:00
Brian Coca e762095497 better task parsing errors
fixes #14790
2016-03-03 19:51:15 -05:00
Brian Coca c063803a91 raise AnsibleError as an 'expected' exception
fixes #14065
2016-01-25 22:20:55 -05:00
James Cammarata 2b36343451 Missed one place we were appending the incorrectly escaped item to raw params 2015-12-09 17:58:44 -05:00
James Cammarata 1799de8528 Preserve original token when appending to _raw_params in parse_kv
Fixes #13311
2015-12-08 15:06:36 -05:00
Yannig Perré 2c54fb1339 Switch parameters validation after parsing in order to be more consistent between old and new style. 2015-11-26 13:33:58 +01:00
Toshio Kuratomi 4203850d1a Break apart a looped dependency to show a warning when parsing playbooks
Display a warning when a dict key is overwritten by pyyaml
Fixes #12888
2015-10-27 12:39:42 -07:00
Brian Coca 3705d54485 fixed error reporting on splitter 2015-10-01 19:03:04 -04:00
James Cammarata 73aa5686cc Remove octal escapes from unicode escape handling
Fixes #11673
2015-07-25 16:30:11 -04:00
Toshio Kuratomi f44f9569e1 Test unquote works as expected and fix two bugs:
* escaped end quote
* a single quote character
2015-07-06 13:16:42 -07:00
James Cammarata ce3ef7f4c1 Making the switch to v2 2015-05-03 21:47:26 -05:00