From 4124f8c381f3ab33512d16bb7e671814b327ef40 Mon Sep 17 00:00:00 2001 From: Brian Coca Date: Fri, 13 Feb 2015 11:06:06 -0500 Subject: [PATCH] now module fails gracefully instead of stacktrace when trying to install missing deb file --- lib/ansible/modules/packaging/os/apt.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/lib/ansible/modules/packaging/os/apt.py b/lib/ansible/modules/packaging/os/apt.py index 3b5f6691de..8730e22e35 100644 --- a/lib/ansible/modules/packaging/os/apt.py +++ b/lib/ansible/modules/packaging/os/apt.py @@ -363,7 +363,10 @@ def install_deb(m, debs, cache, force, install_recommends, dpkg_options): deps_to_install = [] pkgs_to_install = [] for deb_file in debs.split(','): - pkg = apt.debfile.DebPackage(deb_file) + 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: