mirror of
https://github.com/ansible/ansible.git
synced 2026-08-05 16:13:06 +02:00
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
This commit is contained in:
@@ -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,
|
||||
'version': package.version,
|
||||
'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:
|
||||
result['yumstate'] = 'available'
|
||||
|
||||
@@ -867,3 +867,18 @@
|
||||
- test-package-that-provides-toaster
|
||||
- toaster
|
||||
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'
|
||||
|
||||
Reference in New Issue
Block a user