mirror of
https://github.com/ansible-collections/community.general.git
synced 2026-06-11 10:35:34 +00:00
[PR #12168/1e3da48d backport][stable-13] portage: include msg in depclean failure fail_json (#12175)
portage: include msg in depclean failure fail_json (#12168)
cleanup_packages() called module.fail_json(cmd=, rc=, stdout=, stderr=)
without the mandatory msg= argument. When the underlying emerge --depclean
exited non-zero, AnsibleModule.fail_json() itself crashed with
"AnsibleModule.fail_json() missing 1 required positional argument: 'msg'"
before the real failure could reach the controller, leaving users with no
diagnostic about why depclean actually failed.
Same wording style as the sibling install_packages() failure branch
("Packages not installed.").
(cherry picked from commit 1e3da48d70)
Co-authored-by: Yoann Gauthier-Colin <yoann@gwerlas.net>
This commit is contained in:
parent
8f62bee2ac
commit
f414c77e17
2 changed files with 9 additions and 1 deletions
2
changelogs/fragments/portage-depclean-fail_json-msg.yml
Normal file
2
changelogs/fragments/portage-depclean-fail_json-msg.yml
Normal file
|
|
@ -0,0 +1,2 @@
|
|||
bugfixes:
|
||||
- "portage - fix ``depclean: true`` crashing with ``AnsibleModule.fail_json() missing 1 required positional argument: 'msg'`` instead of reporting the actual emerge failure (https://github.com/ansible-collections/community.general/pull/12168)."
|
||||
|
|
@ -508,7 +508,13 @@ def cleanup_packages(module, packages):
|
|||
|
||||
cmd, (rc, out, err) = run_emerge(module, packages, *args)
|
||||
if rc != 0:
|
||||
module.fail_json(cmd=cmd, rc=rc, stdout=out, stderr=err)
|
||||
module.fail_json(
|
||||
cmd=cmd,
|
||||
rc=rc,
|
||||
stdout=out,
|
||||
stderr=err,
|
||||
msg="Packages not cleaned up.",
|
||||
)
|
||||
|
||||
removed = 0
|
||||
for line in out.splitlines():
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue