The apt module won't work with python-apt < 0.8.9 (such as on Ubuntu 10.04) (#75993)

* Check if deb file to deploy has architectures attribute, fixes ansible#47277
pull/75950/head
Víctor A. Rodríguez 3 years ago committed by GitHub
parent f7b7cf6753
commit e53982cd09
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -0,0 +1,2 @@
bugfixes:
- apt - fails to deploy deb file to old debian systems using python-apt < 0.8.9 (https://github.com/ansible/ansible/issues/47277)

@ -787,10 +787,10 @@ def install_deb(m, debs, cache, force, fail_on_autoremove, install_recommends, a
pkgs_to_install = []
for deb_file in debs.split(','):
try:
pkg = apt.debfile.DebPackage(deb_file)
pkg = apt.debfile.DebPackage(deb_file, cache=apt.Cache())
pkg_name = get_field_of_deb(m, deb_file, "Package")
pkg_version = get_field_of_deb(m, deb_file, "Version")
if len(apt_pkg.get_architectures()) > 1:
if hasattr(apt_pkg, 'get_architectures') and len(apt_pkg.get_architectures()) > 1:
pkg_arch = get_field_of_deb(m, deb_file, "Architecture")
pkg_key = "%s:%s" % (pkg_name, pkg_arch)
else:

Loading…
Cancel
Save