diff options
author | Brian Coca <brian.coca+git@gmail.com> | 2015-08-18 14:59:35 -0400 |
---|---|---|
committer | Brian Coca <brian.coca+git@gmail.com> | 2015-08-18 15:01:06 -0400 |
commit | b907189e3c4aa3dcb2a85fb11c31dce2ac73b750 (patch) | |
tree | 9588e6bd9209ed242fd0ba5c64a4cec1af237eb5 | |
parent | 1ceac602bb9afd5a77022585d14d78d3603d49c1 (diff) | |
download | ansible-modules-core-b907189e3c4aa3dcb2a85fb11c31dce2ac73b750.tar.gz |
deal with more failures when apt module fails to instantiate pkg
fixes #1499
-rw-r--r-- | packaging/os/apt.py | 23 |
1 files changed, 12 insertions, 11 deletions
diff --git a/packaging/os/apt.py b/packaging/os/apt.py index 5c42d6dc..7aee9a78 100644 --- a/packaging/os/apt.py +++ b/packaging/os/apt.py @@ -365,19 +365,20 @@ def install_deb(m, debs, cache, force, install_recommends, dpkg_options): for deb_file in debs.split(','): try: pkg = apt.debfile.DebPackage(deb_file) - except SystemError, e: - m.fail_json(msg="Error: %s\nSystem Error: %s" % (pkg._failure_string,str(e))) - # Check if it's already installed - if pkg.compare_to_version_in_cache() == pkg.VERSION_SAME: - continue - # Check if package is installable - if not pkg.check() and not force: - m.fail_json(msg=pkg._failure_string) + # Check if it's already installed + if pkg.compare_to_version_in_cache() == pkg.VERSION_SAME: + continue + # Check if package is installable + if not pkg.check() and not force: + m.fail_json(msg=pkg._failure_string) + + # add any missing deps to the list of deps we need + # to install so they're all done in one shot + deps_to_install.extend(pkg.missing_deps) - # add any missing deps to the list of deps we need - # to install so they're all done in one shot - deps_to_install.extend(pkg.missing_deps) + except Exception, e: + m.fail_json(msg="Unable to install package: %s" % str(e)) # and add this deb to the list of packages to install pkgs_to_install.append(deb_file) |