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"}
This commit is contained in:
Allen Fair 2018-09-04 10:27:57 -04:00 committed by Brian Coca
parent cd5d484f7a
commit 8fb589d55e

View file

@ -209,7 +209,7 @@ def install_packages(module, pkgng_path, packages, cached, pkgsite, dir_arg, sta
else: else:
rc, out, err = module.run_command("%s %s update" % (pkgng_path, dir_arg)) rc, out, err = module.run_command("%s %s update" % (pkgng_path, dir_arg))
if rc != 0: 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: for package in packages:
already_installed = query_package(module, pkgng_path, package, dir_arg) already_installed = query_package(module, pkgng_path, package, dir_arg)