summaryrefslogtreecommitdiff
path: root/lib/ansible/errors
Commit message (Collapse)AuthorAgeFilesLines
* Misc typo fixes (#66120)Abhijeet Kasurde2020-01-041-1/+1
| | | Signed-off-by: Abhijeet Kasurde <akasurde@redhat.com>
* include_vars: Check NoneType for raw_params (#64979)Abhijeet Kasurde2019-11-261-2/+4
| | | | | | | | | Lookup 'first_found' returns empty list which results in raw_params checking. Check NoneType for 'raw_params' before proceeding. Fixes: #64939 Signed-off-by: Abhijeet Kasurde <akasurde@redhat.com>
* Catch sshpass authentication errors and don't retry multiple times to ↵Sam Doran2019-01-231-0/+5
| | | | | | | | | | | | | | | | | | | | | | | | | | prevent account lockout (#50776) * Catch SSH authentication errors and don't retry multiple times to prevent account lock out Signed-off-by: Sam Doran <sdoran@redhat.com> * Subclass AnsibleAuthenticationFailure from AnsibleConnectionFailure Use comparison rather than range() because it's much more efficient. Signed-off-by: Sam Doran <sdoran@redhat.com> * Add tests Signed-off-by: Sam Doran <sdoran@redhat.com> * Make paramiko_ssh connection plugin behave the same way Signed-off-by: Sam Doran <sdoran@redhat.com> * Add changelog Signed-off-by: Sam Doran <sdoran@redhat.com>
* remove usless tb initiatorBrian Coca2019-01-221-4/+0
| | | | always pass proper tb
* Add new AnsibleTemplateError to more easily catch templating issues (#50563)Matt Martz2019-01-041-7/+12
| | | | | | * Add new AnsibleTemplateError to more easily catch templating issues. Fixes #50154 * Add changelog fragment
* Add better error when k=v syntax is used with YAML in tasks (#41754)Sam Doran2018-12-042-15/+34
| | | | | | | | | | | | | | | | | | | | | | | | * Add error message for k=v and YAML in a single task Find the correct line, column, and position for k=v errors since they are different than the position reported initially. Document bug in quoting syntax check. * Change tense or error message Since the error still exists, switch to present tense rather than past tense. * Remove double spaces after periods in error messages. http://www.slate.com/articles/technology/technology/2011/01/space_invaders.html * Add changelog fragment * Add tests for new error message * Fix tests * Add clarifying comments to unit test
* Python 3.8 collections compatibility fixes.Matt Clay2018-10-081-1/+1
| | | | Includes a new pylint blacklist plugin to prevent regressions.
* give hint to users when a file is not foundBrian Coca2018-04-101-0/+2
|
* Make AnsibleActionDone a private exceptionToshio Kuratomi2018-01-221-1/+2
| | | | | We're going to remove this in the future so mark it private so people are less likely to use it.
* Temporary (#31677)Brian Coca2018-01-151-3/+30
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * allow shells to have per host options, remote_tmp added language to shell removed module lang setting from general as plugins have it now use get to avoid bad powershell plugin more resilient tmp discovery, fall back to `pwd` add shell to docs fixed options for when frags are only options added shell set ops in t_e and fixed option frags normalize tmp dir usag4e - pass tmpdir/tmp/temp options as env var to commands, making it default for tempfile - adjusted ansiballz tmpdir - default local tempfile usage to the configured local tmp - set env temp in action add options to powershell shift temporary to internal envvar/params ensure tempdir is set if we pass var ensure basic and url use expected tempdir ensure localhost uses local tmp give /var/tmp priority, less perms issues more consistent tempfile mgmt for ansiballz made async_dir configurable better action handling, allow for finally rm tmp fixed tmp issue and no more tempdir in ballz hostvarize world readable and admin users always set shell tempdir added comment to discourage use of exception/flow control * Mostly revert expand_user as it's not quite working. This was an additional feature anyhow. Kept the use of pwd as a fallback but moved it to a second ssh connection. This is not optimal but getting that to work in a single ssh connection was part of the problem holding this up. (cherry picked from commit 395b714120522f15e4c90a346f5e8e8d79213aca) * fixed script and other action plugins ensure tmpdir deletion allow for connections that don't support new options (legacy, 3rd party) fixed tests
* Correct the AnsibleError exception to call its superclass's constructorToshio Kuratomi2017-12-211-0/+2
|
* Remove uses of assert in production code (#32079)Matt Martz2017-11-131-0/+5
| | | | | | | | | | | | | | | | * Remove uses of assert in production code * Fix assertion * Add code smell test for assertions, currently limited to lib/ansible * Fix assertion * Add docs for no-assert * Remove new assert from enos * Fix assert in module_utils.connection
* more info on yaml errorsBrian Coca2017-10-301-1/+1
| | | | print yaml's 'problem'
* report extra info in verbose and if neededBrian Coca2017-10-031-2/+0
|
* Ansible Config part2 (#27448)Brian Coca2017-08-151-0/+4
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * Ansible Config part2 - made dump_me nicer, added note this is not prod - moved internal key removal function to vars - carry tracebacks in errors we can now show tracebacks for plugins on vvv - show inventory plugin tracebacks on vvv - minor fixes to cg groups plugin - draft config from plugin docs - made search path warning 'saner' (top level dirs only) - correctly display config entries and others - removed unneeded code - commented out some conn plugin specific from base.yml - also deprecated sudo/su - updated ssh conn docs - shared get option method for connection plugins - note about needing eval for defaults - tailored yaml ext - updated strategy entry - for connection pliugins, options load on plugin load - allow for long types in definitions - better display in ansible-doc - cleaned up/updated source docs and base.yml - added many descriptions - deprecated include toggles as include is - draft backwards compat get_config - fixes to ansible-config, added --only-changed - some code reoorg - small license headers - show default in doc type - pushed module utils details to 5vs - work w/o config file - PEPE ATE! - moved loader to it's own file - fixed rhn_register test - fixed boto requirement in make tests - I ate Pepe - fixed dynamic eval of defaults - better doc code skip ipaddr filter tests when missing netaddr removed devnull string from config better becoem resolution * killed extra space with extreeme prejudice cause its an affront against all that is holy that 2 spaces touch each other! shippable timing out on some images, but merging as it passes most
* correct, cleanup & simplify dwim stack (#25956)Brian Coca2017-07-031-1/+21
| | | | | | | | | | | | | | | * correct, cleanup & simplify dwim stack latlh chIS logh HeS qar wej chel laD better errors update find_file to new exception * addressed latest comments * test should not use realpath as it follows symlink this fails when on OS X as /var is now a symlink to /private/var but first_found was not supposed to follow symlinks
* Try to show original exception info for yaml (and other) errors (#24468)Adrian Likins2017-06-091-1/+5
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * 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 781bb44b029becef60af9c9ce765129c7c9c7287.
* ansible/errors: PEP8 compliancy (#24693)Dag Wieers2017-05-181-12/+28
| | | - Make PEP8 compliant
* moved to exceptions for basic skip/failsBrian Coca2017-04-251-0/+7
| | | | | better handling of checkmode and async fix test to follow new flow control
* E501 fixes (#22879)Matt Martz2017-03-221-2/+10
|
* removes unneeded exceptionPeter Sprygada2017-03-201-5/+0
|
* adds feature to all modules to be run locally (#18763)Peter Sprygada2016-12-151-0/+5
| | | | | | | | | | | * adds new error AnsibleModuleExit to handle module returns * adds new action plugin network for attaching connection to network modules * adds new shared module local to receive connection * splits out function to update task_args with common updates This commit provides a mechansim for running local modules that require a connection object for interative commands tyically implemented for network devices. It provides a way to locally import modules (post fork) and run them using exception handling to exit.
* Add error info if tabs are found in the yaml (#18343)Adrian Likins2016-11-082-1/+22
| | | | | If a yaml file fails to load because of tabs being used for formatting, detect that and show a error message with more details.
* Move uses of to_bytes, to_text, to_native to use the module_utils version ↵Toshio Kuratomi2016-09-061-7/+6
| | | | | | | | (#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.
* Fix some typos (#16498)Shota2016-06-291-1/+1
|
* Add options to make includes 'static'James Cammarata2016-03-241-2/+4
| | | | | | * Can be configured in the ansible.cfg for tasks/handlers individually * If an included filename contains no vars or loops, it will be expanded in-place as if it were marked as static
* Relocate use of ERROR to display class, to avoid doubling upJames Cammarata2016-01-191-2/+2
|
* be consistent about conversion to_strBrian Coca2016-01-181-1/+1
|
* Allow Ansible to return error with unicode within it.Yannig Perré2016-01-141-1/+1
| | | | Fix for https://github.com/ansible/ansible/issues/13899
* Default msg param to AnsibleError to avoid serialization problemsJames Cammarata2015-12-021-1/+1
|
* Clean up a few more pyflakes warningsToshio Kuratomi2015-10-191-1/+7
|
* Move to_str alias into ansible.utils.unicodeMarius Gedminas2015-10-151-9/+1
| | | | | @abadger suggested on IRC that it's useful enough to go into ansible.utils.unicode.
* Python 3: fix AnsibleError formattingMarius Gedminas2015-10-151-3/+10
| | | | | | | | | | | | | | | | | If you convert the error string to bytes and embed it inside another error string, you get Prefix: b'Embedded\nerror\nstring' which is not what we want. But we also don't want Unicode in error messages causing unexpected UnicodeEncodeErrors when on Python 2. So let's convert the error message into the native string type (bytes on Python 2, unicode on Python 3).
* Improve handling of unicode errorsJames Cammarata2015-10-081-1/+4
| | | | Fixes #12669
* Making the switch to v2James Cammarata2015-05-032-0/+303