Allow api module to fail (#39)

* Allow api module to fail.

* Improve error handling.

* Fix api unit tests.

* Add very basic tests of return values.

* Update api.py

fix ignoring the Fail task if we get TrapError

* Do not mangle fail result, and adjust tests.

* Improve changelog fragment.

* Reclassify changelog fragment as minor_changes, improve text.

* Mark changelog as 'breaking change'.

Co-authored-by: Nikolay Dachev <nikolay@dachev.info>
This commit is contained in:
Felix Fontein 2021-07-11 15:53:22 +02:00 committed by GitHub
parent df88a7ec99
commit 69682054e1
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 94 additions and 61 deletions

View file

@ -0,0 +1,8 @@
breaking_changes:
- >-
api - due to a programming error, the module never failed on errors. This has now been fixed.
If you are relying on the module not failing in case of idempotent commands
(resulting in errors like ``failure: already have such address``), you need to adjust your roles/playbooks.
We suggest to use ``failed_when`` to accept failure in specific circumstances,
for example ``failed_when: "'failure: already have ' in result.msg[0]"``
(https://github.com/ansible-collections/community.routeros/pull/39).