1
0
Fork 0
mirror of https://github.com/ansible-collections/community.general.git synced 2024-09-14 20:13:21 +02:00
community.general/lib/ansible
Dag Wieers 93cfe73a76 Report detailed error when internal remote functions fail
This is a redesign in how plugins call _remote_checksum().

- _remote_stat() has been modified to report the real error as
  AnsiblError
- Action plugin **unarchive** calls _remote_stat() directly instead of
   _remote_checksum()
- Action plugin **unarchive** also handles the exceptions directly
- Ensure get_exception() returns native text

Two other action plugins, **template** and **fetch**, also do a remote checksum.
In **template** we already call _remote_stat(), just like we now do for
unarchive, in **fetch** we do call _remote_checksum() and we make the
exact same mistake as the unarchive plugin. So that one could use a
redesign as well.

This fixes #19494

Before:
```
[dag@moria ansible.testing]$ ansible-playbook -v test137.yml
Using /home/dag/home-made/ansible.testing/ansible.cfg as config file

PLAY [localhost]
******************************************************************************************************

TASK [unarchive]
******************************************************************************************************
fatal: [localhost]: FAILED! => {"changed": false, "failed": true, "msg":
"python isn't present on the system.  Unable to compute checksum"}

PLAY RECAP
******************************************************************************************************
localhost                  : ok=0    changed=0    unreachable=0
failed=1
```

After:
```
[dag@moria ansible.testing]$ ansible-playbook -v test137.yml
Using /home/dag/home-made/ansible.testing/ansible.cfg as config file

PLAY [localhost]
*************************************************************************************************************

TASK [unarchive]
*************************************************************************************************************
fatal: [localhost]: FAILED! => {"changed": false, "failed": true, "msg":
"Failed to get information on remote file (/tmp/): sudo: unknown user:
foobar\nsudo: unable to initialize policy plugin\n"}

PLAY RECAP
*******************************************************************************************************************
localhost                  : ok=0    changed=0    unreachable=0
failed=1
```
2016-12-19 21:04:48 -05:00
..
cli show filename for module 2016-12-19 14:48:19 -05:00
compat
config
errors adds feature to all modules to be run locally (#18763) 2016-12-15 15:47:29 -05:00
executor adds feature to allow connection to set action plugin (#18762) 2016-12-15 15:47:39 -05:00
galaxy
inventory minor spelling changes 2016-12-13 13:51:13 -05:00
module_utils Better error msg for basic.get_bin_path() 2016-12-19 20:55:52 -05:00
modules Improve YAML examples - windows/win_package.py (#19407) 2016-12-19 13:58:28 -08:00
parsing adds new module net_command for network devices (#19468) 2016-12-19 11:21:37 -05:00
playbook still needs static for task object 2016-12-16 23:52:11 -05:00
plugins Report detailed error when internal remote functions fail 2016-12-19 21:04:48 -05:00
template Fix AST nodes for Python 3 and enable dependent test_uri (#18597) 2016-12-13 07:37:39 -08:00
utils minor spelling changes 2016-12-13 13:51:13 -05:00
vars Display proper error on group_vars syntax error 2016-12-16 21:13:41 -05:00
__init__.py
constants.py adds new module net_command for network devices (#19468) 2016-12-19 11:21:37 -05:00
release.py
test-requirements.txt Making the switch to v2 2015-05-03 21:47:26 -05:00