Merge pull request #4934 from mscherer/fix_urpmi_2

return failed if a package couldn't be installed
This commit is contained in:
Michael DeHaan 2013-11-19 11:35:51 -08:00
commit 2530c113df

View file

@ -158,7 +158,14 @@ def install_packages(module, pkgspec, force=True, no_suggests=True):
cmd = ("%s --auto %s --quiet %s %s > /dev/null" % (URPMI_PATH, force_yes, no_suggests_yes, packages))
rc, out, err = module.run_command(cmd)
if rc:
installed = True
for packages in pkgspec:
if not query_package_provides(module, package):
installed = False
# urpmi always have 0 for exit code if --force is used
if rc or not installed:
module.fail_json(msg="'urpmi %s' failed: %s" % (packages, err))
else:
module.exit_json(changed=True, msg="%s present(s)" % packages)