diff options
author | Brian Coca <bcoca@ansible.com> | 2015-05-26 11:55:44 -0400 |
---|---|---|
committer | Brian Coca <bcoca@ansible.com> | 2015-05-26 11:55:44 -0400 |
commit | 6d088169ef7d9eb3511cfdcefc765b9f07b33578 (patch) | |
tree | bd2f2e731f14c376305774050ec128b383fca1c7 | |
parent | 0d41af23c23c5cf777afb59853040c057ccddbb3 (diff) | |
parent | adf34a6ccde75f32403d3d28a24f28ed9281c52a (diff) | |
download | ansible-modules-core-6d088169ef7d9eb3511cfdcefc765b9f07b33578.tar.gz |
Merge pull request #1348 from devjatkin/issue_1230
fix apt to handle virtual packages correctly
-rw-r--r-- | packaging/os/apt.py | 12 |
1 files changed, 10 insertions, 2 deletions
diff --git a/packaging/os/apt.py b/packaging/os/apt.py index 584177a9..61e2fc3f 100644 --- a/packaging/os/apt.py +++ b/packaging/os/apt.py @@ -228,8 +228,16 @@ def package_status(m, pkgname, version, cache, state): except KeyError: if state == 'install': try: - if cache.get_providing_packages(pkgname): - return False, True, False + provided_packages = cache.get_providing_packages(pkgname) + if provided_packages: + is_installed = False + # when virtual package providing only one package, look up status of target package + if cache.is_virtual_package(pkgname) and len(provided_packages) == 1: + package = provided_packages[0] + installed, upgradable, has_files = package_status(m, package.name, version, cache, state='install') + if installed: + is_installed = True + return is_installed, True, False m.fail_json(msg="No package matching '%s' is available" % pkgname) except AttributeError: # python-apt version too old to detect virtual packages |