dnf - arches must be the same in the is_newer_installed check (#83417) (#83504)

Fixes #83406

(cherry picked from commit 2930a4664c)
pull/83545/head
Martin Krizek 5 months ago committed by GitHub
parent 850da817c5
commit 6966b53b5b
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

@ -0,0 +1,2 @@
bugfixes:
- dnf - fix an issue where two packages of the same ``evr`` but different arch failed to install (https://github.com/ansible/ansible/issues/83406)

@ -754,7 +754,7 @@ class DnfModule(YumDnf):
installed = sorted(self.base.sack.query().installed().filter(name=available.name).run())[-1]
except IndexError:
return False
return installed > available
return installed.evr_gt(available) and installed.arch == available.arch
def _mark_package_install(self, pkg_spec, upgrade=False):
"""Mark the package for install."""

@ -542,3 +542,23 @@
dnf:
name: provides_foo*
state: absent
- name: test that only evr is compared, avoiding a situation when a specific arch would be considered as a "newer" package
block:
- dnf:
name: "{{ item }}"
state: present
loop:
- "dinginessentail-1.0-1.x86_64"
- "dinginessentail-1.0-1.i686"
register: dnf_results
- assert:
that:
- dnf_results["results"][0] is changed
- dnf_results["results"][1] is changed
always:
- name: Clean up
dnf:
name: dinginessentail
state: absent

Loading…
Cancel
Save