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

Bugfix: zypper issue with specified package versions #4421

Merged
merged 4 commits into from
Apr 5, 2022
Merged

Bugfix: zypper issue with specified package versions #4421

merged 4 commits into from
Apr 5, 2022

Conversation

tover99
Copy link
Contributor

@tover99 tover99 commented Mar 29, 2022

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.

SUMMARY

I added an empty check to prevent get_installed_state() being called with an empty package list.

Fixes ##4371

ISSUE TYPE
  • Bugfix Pull Request
COMPONENT NAME

zypper

ADDITIONAL INFORMATION

The following task ALWAYS reported [ok] if ANY version of a-very-important-package was already installed on the target system.

    - name: Install a specific package version via zypper
      zypper:
        name:
          - "a-very-important-package=2.1"
        state: present
        oldpackage : yes

As soon as at least ONE other package WITHOUT a version specification was requestet, everything worked as expected.

    - name: Install a specific package version via zypper
      zypper:
        name:
          - "a-very-important-package=2.1"
          - "another-package"
        state: present
        oldpackage : yes

after my fix, that workaroud is not necessary and both of the above work as expected

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.
@ansibullbot
Copy link
Collaborator

@ansibullbot ansibullbot added bug This issue/PR relates to a bug module module new_contributor Help guide this first time contributor os packaging plugins plugin (any type) small_patch Hopefully easy to review labels Mar 29, 2022
@tover99 tover99 changed the title fixed issue with specified package versions Bugfix: zypper issue with specified package versions Mar 29, 2022
Copy link
Collaborator

@felixfontein felixfontein left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for your contribution! Can you add a changelog fragment? Thanks.

@felixfontein felixfontein added check-before-release PR will be looked at again shortly before release and merged if possible. backport-3 labels Mar 29, 2022
@ansibullbot ansibullbot removed the small_patch Hopefully easy to review label Mar 29, 2022
@tover99
Copy link
Contributor Author

tover99 commented Mar 29, 2022

Thanks for your contribution! Can you add a changelog fragment? Thanks.

done ... on 2nd try 🙈 ...

Copy link
Collaborator

@felixfontein felixfontein left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good to me! If nobody complains, I'll merge beginning of next week.

(I'm not using zypper, so would be great if someone else who actually uses / knows zypper can take a look :) )

Copy link

@evrardjp evrardjp left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I am okay with this, but I didn't test it.

@felixfontein felixfontein merged commit bbe231e into ansible-collections:main Apr 5, 2022
@felixfontein felixfontein removed the check-before-release PR will be looked at again shortly before release and merged if possible. label Apr 5, 2022
@patchback
Copy link

patchback bot commented Apr 5, 2022

Backport to stable-3: 💚 backport PR created

✅ Backport PR branch: patchback/backports/stable-3/bbe231e2612a081c8c8489ba4c0c5554f2e06bda/pr-4421

Backported as #4445

🤖 @patchback
I'm built with octomachinery and
my source is open — https://github.com/sanitizers/patchback-github-app.

patchback bot pushed a commit that referenced this pull request Apr 5, 2022
* 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 #4421

* Delete 4421-zypper_package_version_handling_fix

* Create 4421-zypper_package_version_handling_fix.yml

(cherry picked from commit bbe231e)
@patchback
Copy link

patchback bot commented Apr 5, 2022

Backport to stable-4: 💚 backport PR created

✅ Backport PR branch: patchback/backports/stable-4/bbe231e2612a081c8c8489ba4c0c5554f2e06bda/pr-4421

Backported as #4446

🤖 @patchback
I'm built with octomachinery and
my source is open — https://github.com/sanitizers/patchback-github-app.

patchback bot pushed a commit that referenced this pull request Apr 5, 2022
* 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 #4421

* Delete 4421-zypper_package_version_handling_fix

* Create 4421-zypper_package_version_handling_fix.yml

(cherry picked from commit bbe231e)
@felixfontein
Copy link
Collaborator

@tover99 thanks for fixing this!
@evrardjp thanks for reviewing!

felixfontein pushed a commit that referenced this pull request Apr 5, 2022
* 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 #4421

* Delete 4421-zypper_package_version_handling_fix

* Create 4421-zypper_package_version_handling_fix.yml

(cherry picked from commit bbe231e)

Co-authored-by: tover99 <101673769+tover99@users.noreply.github.com>
felixfontein pushed a commit that referenced this pull request Apr 5, 2022
* 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 #4421

* Delete 4421-zypper_package_version_handling_fix

* Create 4421-zypper_package_version_handling_fix.yml

(cherry picked from commit bbe231e)

Co-authored-by: tover99 <101673769+tover99@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug This issue/PR relates to a bug module module new_contributor Help guide this first time contributor os packaging plugins plugin (any type)
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants