Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[BUG] Zypperpkg does not use the version parameter #658

Open
m-czernek opened this issue Jun 13, 2024 · 0 comments
Open

[BUG] Zypperpkg does not use the version parameter #658

m-czernek opened this issue Jun 13, 2024 · 0 comments
Assignees

Comments

@m-czernek
Copy link
Contributor

Description
When using the pkg.removed function with the version parameter to remove a specific package version, the zypperpkg module does not use the version parameter to remove only that specified package. The assumption is that the pkg module verifies that the version is installed in [0], and the zypperpkg module then removes the package without using a version in [1].

This assumption does not hold for RPM packages that enable multiple versions installed at the same time, such as the kernel package. In such cases, zypperpkg removes the package by using its name, which results in both kernel versions being removed.

For example, this SLS:

remove_previous_kernel_default:
  pkg.removed:
    - name: kernel-default
    - version: 6.4.0-150600.21.1

results in no Kernels installed:

localhost:~ # rpm -qa | grep kernel-default
kernel-default-6.9.1-1.1.x86_64
kernel-default-6.4.0-150600.21.1.x86_64
localhost:~ # salt-call --local state.sls test
local:
----------
          ID: remove_previous_kernel-default
    Function: pkg.removed
        Name: kernel-default
      Result: True
     Comment: All targeted packages were removed.
     Started: 17:03:13.430864
    Duration: 3788.295 ms
     Changes:   
              ----------
              kernel-default:
                  ----------
                  new:
                  old:
                      6.4.0-150600.21.1,6.9.1-1.1
localhost:~ # rpm -qa | grep kernel-default

[0] https://github.com/openSUSE/salt/blob/openSUSE/release/3006.0/salt/states/pkg.py#L2903-L2905
[1] https://github.com/openSUSE/salt/blob/openSUSE/release/3006.0/salt/modules/zypperpkg.py#L2150

Expected behavior
Only the specified RPM package version gets removed.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
1 participant