dnf: align the return value of the list argument with yum (#75501)

* dnf: align the return value of the list argument with yum

Fixes #75483

* Add integration test
pull/75532/head
Martin Krizek 3 years ago committed by GitHub
parent 13e6bd9232
commit 1c34492413
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -0,0 +1,2 @@
bugfixes:
- dnf - align the return value of the list argument with the ``yum`` module (https://github.com/ansible/ansible/issues/75483)

@ -425,8 +425,13 @@ class DnfModule(YumDnf):
'release': package.release, 'release': package.release,
'version': package.version, 'version': package.version,
'repo': package.repoid} 'repo': package.repoid}
result['nevra'] = '{epoch}:{name}-{version}-{release}.{arch}'.format(
**result) # envra format for alignment with the yum module
result['envra'] = '{epoch}:{name}-{version}-{release}.{arch}'.format(**result)
# keep nevra key for backwards compat as it was previously
# defined with a value in envra format
result['nevra'] = result['envra']
if package.installtime == 0: if package.installtime == 0:
result['yumstate'] = 'available' result['yumstate'] = 'available'

@ -867,3 +867,18 @@
- test-package-that-provides-toaster - test-package-that-provides-toaster
- toaster - toaster
state: absent state: absent
- yum:
list: "{{ package1 }}"
register: list_out
- name: check that both yum and dnf return envra
assert:
that:
- '"envra" in list_out["results"][0]'
- name: check that dnf returns nevra for backwards compat
assert:
that:
- '"nevra" in list_out["results"][0]'
when: ansible_pkg_mgr == 'dnf'

Loading…
Cancel
Save