mirror of
https://github.com/ansible-collections/community.general.git
synced 2024-09-14 20:13:21 +02:00
Bugfix: zypper issue with specified package versions (#4421)
* 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
This commit is contained in:
parent
9e0ff8ba4b
commit
bbe231e261
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).
|
|
@ -427,7 +427,9 @@ def package_present(m, name, want_latest):
|
||||||
# if a version is given leave the package in to let zypper handle the version
|
# if a version is given leave the package in to let zypper handle the version
|
||||||
# resolution
|
# resolution
|
||||||
packageswithoutversion = [p for p in packages if not p.version]
|
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
|
# generate lists of packages to install or remove
|
||||||
packages = [p for p in packages if p.shouldinstall != (p.name in prerun_state)]
|
packages = [p for p in packages if p.shouldinstall != (p.name in prerun_state)]
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue