From 8fb589d55ed1b3ff509b1cb64fffb3d93bee8027 Mon Sep 17 00:00:00 2001 From: Allen Fair Date: Tue, 4 Sep 2018 10:27:57 -0400 Subject: [PATCH] Returns reason on pkg update error (#44982) Previously, it returned no additional information: "msg": "Could not update catalogue" Now it passes that reason with the error message: {"changed": false, "msg": "Could not update catalogue [77]: pkg: Insufficient privileges to update the repository catalogue.\n"} --- lib/ansible/modules/packaging/os/pkgng.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/ansible/modules/packaging/os/pkgng.py b/lib/ansible/modules/packaging/os/pkgng.py index d68967ca4d..1136347904 100644 --- a/lib/ansible/modules/packaging/os/pkgng.py +++ b/lib/ansible/modules/packaging/os/pkgng.py @@ -209,7 +209,7 @@ def install_packages(module, pkgng_path, packages, cached, pkgsite, dir_arg, sta else: rc, out, err = module.run_command("%s %s update" % (pkgng_path, dir_arg)) if rc != 0: - module.fail_json(msg="Could not update catalogue") + module.fail_json(msg="Could not update catalogue [%d]: %s %s" % (rc, out, err)) for package in packages: already_installed = query_package(module, pkgng_path, package, dir_arg)