From a748229f3a4df41bcb40ffc80315aeb611e73a92 Mon Sep 17 00:00:00 2001 From: FabioBatSilva Date: Tue, 23 Dec 2014 19:54:25 -0500 Subject: [PATCH] fix compatibility issues with python-apt < 0.7.9 --- lib/ansible/modules/packaging/os/apt.py | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/lib/ansible/modules/packaging/os/apt.py b/lib/ansible/modules/packaging/os/apt.py index 6e2f26f723..d5ae62d532 100644 --- a/lib/ansible/modules/packaging/os/apt.py +++ b/lib/ansible/modules/packaging/os/apt.py @@ -206,7 +206,12 @@ def package_status(m, pkgname, version, cache, state): package_is_installed = pkg.isInstalled if version: - avail_upgrades = fnmatch.filter((p.version for p in pkg.versions), version) + try: + avail_upgrades = fnmatch.filter((p.version for p in pkg.versions), version) + except AttributeError: + # assume older version of python-apt is installed + # apt.package.Package#versions require python-apt >= 0.7.9. + avail_upgrades = [] if package_is_installed: try: