mirror of
https://github.com/ansible-collections/community.general.git
synced 2024-09-14 20:13:21 +02:00
* fixed issue with specified package versions
zypper.py was doing nothing on state=present, when ALL requestet/checked packages had a specific version stated. This was caused by get_installed_state() being called with an empty package list, which in this case returns information about all ALL installed packages. This lead to an exessive filter list prerun_state, essentially removing all packages that are installed in ANY version on the target system from the request list.
* Create 4421-zypper_package_version_handling_fix
added changelog fragment for https://github.com/ansible-collections/community.general/pull/4421
* Delete 4421-zypper_package_version_handling_fix
* Create 4421-zypper_package_version_handling_fix.yml
(cherry picked from commit bbe231e261
)
Co-authored-by: tover99 <101673769+tover99@users.noreply.github.com>
This commit is contained in:
parent
75dce4b1de
commit
a339f97d89
2 changed files with 5 additions and 1 deletions
|
@ -0,0 +1,2 @@
|
|||
bugfixes:
|
||||
- zypper - fixed bug that caused zypper to always report [ok] and do nothing on ``state=present`` when all packages in ``name`` had a version specification (https://github.com/ansible-collections/community.general/issues/4371, https://github.com/ansible-collections/community.general/pull/4421).
|
|
@ -417,7 +417,9 @@ def package_present(m, name, want_latest):
|
|||
# if a version is given leave the package in to let zypper handle the version
|
||||
# resolution
|
||||
packageswithoutversion = [p for p in packages if not p.version]
|
||||
prerun_state = get_installed_state(m, packageswithoutversion)
|
||||
prerun_state = {}
|
||||
if packageswithoutversion:
|
||||
prerun_state = get_installed_state(m, packageswithoutversion)
|
||||
# generate lists of packages to install or remove
|
||||
packages = [p for p in packages if p.shouldinstall != (p.name in prerun_state)]
|
||||
|
||||
|
|
Loading…
Reference in a new issue