From 21bfa80203dd4e081669365e262238ca3bf5d3bf Mon Sep 17 00:00:00 2001 From: fabios Date: Sat, 27 Dec 2014 15:30:56 -0500 Subject: [PATCH] older python-apt compatibility --- lib/ansible/modules/packaging/os/apt.py | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/lib/ansible/modules/packaging/os/apt.py b/lib/ansible/modules/packaging/os/apt.py index 7eba3432e60..d1101bc7b8b 100644 --- a/lib/ansible/modules/packaging/os/apt.py +++ b/lib/ansible/modules/packaging/os/apt.py @@ -202,8 +202,12 @@ def package_status(m, pkgname, version, cache, state): ll_pkg = cache._cache[pkgname] # the low-level package object except KeyError: if state == 'install': - if cache.get_providing_packages(pkgname): - return False, True, False + try: + if cache.get_providing_packages(pkgname): + return False, True, False + except AttributeError: + # older python-apt providing packages cannot be used + pass m.fail_json(msg="No package matching '%s' is available" % pkgname) else: return False, False, False