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

zypper: add simple_errors option - fixes #8416 #9270

Merged
merged 12 commits into from
Dec 25, 2024

Conversation

erichoog
Copy link
Contributor

@erichoog erichoog commented Dec 17, 2024

SUMMARY

This fixes #8416

It adds a simple_errors option for the zypper module which can be used to simplify or reduce the error output of the zypper module during package installs/updates so that only the content of <message> tags are displayed. (Default is false so the default behavior is unaffected)

It also adds a quiet option for the zypper module to allow for the option to disable the --quiet parameter from being passed to the zypper command. (Default is true so the default behavior is unaffected.

ISSUE TYPE
  • Feature Pull Request
COMPONENT NAME

zypper module

@ansibullbot
Copy link
Collaborator

@ansibullbot ansibullbot added feature This issue/PR relates to a feature request module module new_contributor Help guide this first time contributor plugins plugin (any type) labels Dec 17, 2024
@ansibullbot

This comment was marked as outdated.

@ansibullbot ansibullbot added the needs_revision This PR fails CI tests or a maintainer has requested a review/revision of the PR label Dec 17, 2024
@felixfontein felixfontein added check-before-release PR will be looked at again shortly before release and merged if possible. backport-10 Automatically create a backport for the stable-10 branch labels Dec 17, 2024
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 please add a changelog fragment? Thanks.

plugins/modules/zypper.py Outdated Show resolved Hide resolved
plugins/modules/zypper.py Outdated Show resolved Hide resolved
plugins/modules/zypper.py Outdated Show resolved Hide resolved
plugins/modules/zypper.py Outdated Show resolved Hide resolved
plugins/modules/zypper.py Outdated Show resolved Hide resolved
@ansibullbot

This comment was marked as outdated.

@erichoog
Copy link
Contributor Author

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

Changelog fragment added as requested.

changelogs/fragments/9270-zypper-add-simple_errors.yaml Outdated Show resolved Hide resolved
plugins/modules/zypper.py Show resolved Hide resolved
plugins/modules/zypper.py Outdated Show resolved Hide resolved
@ansibullbot ansibullbot removed the needs_revision This PR fails CI tests or a maintainer has requested a review/revision of the PR label Dec 17, 2024
@erichoog
Copy link
Contributor Author

Setting this to draft as it requires some additional work and testing.

@erichoog erichoog changed the title zypper: add simple_errors option - fixes #8416 DRAFT: zypper: add simple_errors option - fixes #8416 Dec 19, 2024
@erichoog
Copy link
Contributor Author

I added an option to turn off the --quiet flag for the zypper command. This does not affect the default behavior unless it is set to quiet: false

With quiet: false I am now able to see the amount of disk space required to install/update the given package.

Here are some examples of the output when updating packages and disk is full using the various flags implemented here. Please note I'm using the stdout_callback: debug config in ansible.cfg

Default options with simple_errors or quiet, not specified in task OR simple_errors: false and quiet: true (not showing the detailed error message and all xml output present):

Screenshot 2024-12-20 110607

simple_errors: false and quiet: false (showing the detailed error message and all xml output present):

Screenshot 2024-12-20 110810

simple_errors: true and quiet: true (not showing the detailed error message and showing only <message> tags from output):

Screenshot 2024-12-20 110231

simple_errors: true and quiet: false (showing the detailed error message and showing only <message> tags from output):

Screenshot 2024-12-20 110303

The final options and screenshot listed above was my targeted output, this will help me troubleshoot patching issues much more quickly and will make finding the specific error much more efficient than visually parsing through large amounts of xml especially when patching many servers at one time.

@erichoog erichoog changed the title DRAFT: zypper: add simple_errors option - fixes #8416 zypper: add simple_errors option - fixes #8416 Dec 20, 2024
@felixfontein
Copy link
Collaborator

Please note that there's now a conflict since we reformatted the module's documentation.

@ansibullbot ansibullbot added needs_rebase https://docs.ansible.com/ansible/devel/dev_guide/developing_rebasing.html needs_revision This PR fails CI tests or a maintainer has requested a review/revision of the PR labels Dec 23, 2024
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.

Besides this and the conflicts, looks good to me!

plugins/modules/zypper.py Outdated Show resolved Hide resolved
@ansibullbot ansibullbot added the needs_ci This PR requires CI testing to be performed. Please close and re-open this PR to trigger CI label Dec 23, 2024
@ansibullbot
Copy link
Collaborator

@erichoog this PR contains the following merge commits:

Please rebase your branch to remove these commits.

click here for bot help

@ansibullbot ansibullbot added merge_commit This PR contains at least one merge commit. Please resolve! and removed needs_ci This PR requires CI testing to be performed. Please close and re-open this PR to trigger CI needs_revision This PR fails CI tests or a maintainer has requested a review/revision of the PR labels Dec 23, 2024
@erichoog
Copy link
Contributor Author

erichoog commented Dec 23, 2024

I made a mess of this rebase, probably should have been using a feature branch but for some reason I didn't this time.

Any suggestions on best approach to clean this up?

I suppose if the commits are all being squashed anyways it doesn't really matter. Please ignore unless it's an issue :)

@felixfontein
Copy link
Collaborator

Can you tick the box that maintainers can push to your branch? (Right now it doesn't seem to be active, at least the tell-tale text is missing.) Then I'll clean it up and force-push it for you.

@felixfontein
Copy link
Collaborator

If you want to try this yourself, I'd probably try running git rebase upstream/master or git rebase upstream master (I always forget which of the two is the right syntax) after a git fetch upstream, if upstream is the remote for ansible-collections/community.general.

@erichoog
Copy link
Contributor Author

If you want to try this yourself, I'd probably try running git rebase upstream/master or git rebase upstream master (I always forget which of the two is the right syntax) after a git fetch upstream, if upstream is the remote for ansible-collections/community.general.

So I already tried this method but when I do I end up getting a bunch of conflicts which I thought I already resolved. You are more than welcome to fix it up if you are able to.

plugins/modules/zypper.py Outdated Show resolved Hide resolved
@felixfontein
Copy link
Collaborator

Can you tick the box that maintainers can push to your branch? (Right now it doesn't seem to be active, at least the tell-tale text is missing.) Then I'll clean it up and force-push it for you.

It looks like the box is already ticked:

image

GitHub changed their UI; previously you could detect that the checkbox was set by looking at the bottom of the discussion, GH would mention there that I (as a maintainer) can add additional commits by pushing to repo/branch. That text is no longer there; I just noticed that now there's an entry in the sidebar on the right: "Maintainers are allowed to edit this pull request." That's definitely easier to find, but not if you expect it to be somewhere else ;-)

I'll try to fix this in the next few minutes.

@felixfontein
Copy link
Collaborator

I think it should be OK now. Can you check? Thanks :)

@erichoog
Copy link
Contributor Author

I think it should be OK now. Can you check? Thanks :)

Thanks very much! I'll check if over now!

@ansibullbot ansibullbot removed merge_commit This PR contains at least one merge commit. Please resolve! needs_rebase https://docs.ansible.com/ansible/devel/dev_guide/developing_rebasing.html labels Dec 23, 2024
@erichoog
Copy link
Contributor Author

I think it should be OK now. Can you check? Thanks :)

Everything is looking good, and my tests looked good as well. Thanks for all your assistance so far!

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 from my side (I don't use Zypper, I only looked at the implementation).

@felixfontein felixfontein merged commit 825e0ee into ansible-collections:main Dec 25, 2024
129 checks passed
Copy link

patchback bot commented Dec 25, 2024

Backport to stable-10: 💚 backport PR created

✅ Backport PR branch: patchback/backports/stable-10/825e0ee377f3bfaea9528d9e76c6041cc9ab193c/pr-9270

Backported as #9370

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

@felixfontein felixfontein removed the check-before-release PR will be looked at again shortly before release and merged if possible. label Dec 25, 2024
patchback bot pushed a commit that referenced this pull request Dec 25, 2024
* zypper: add simple_errors option -fixes #8416

* Fix style issues

* Apply suggestions from code review

Co-authored-by: Felix Fontein <felix@fontein.de>

* Fix indentation

* Add changelog fragment

* Apply suggestions from code review

Co-authored-by: Felix Fontein <felix@fontein.de>

* Updated as per code review recommendations

* Fix whitespace

* Add quiet option, fix logic, update changelog

* Fix trailing whitespace

* Update plugins/modules/zypper.py

Co-authored-by: Felix Fontein <felix@fontein.de>

* Add suggested improvements

---------

Co-authored-by: Eric Hoogeveen <eric.hoogeveen@ssc-spc.gc.ca>
Co-authored-by: Felix Fontein <felix@fontein.de>
(cherry picked from commit 825e0ee)
@felixfontein
Copy link
Collaborator

@erichoog thanks for your contribution!

felixfontein pushed a commit that referenced this pull request Dec 25, 2024
…ion - fixes #8416 (#9370)

zypper: add simple_errors option - fixes #8416 (#9270)

* zypper: add simple_errors option -fixes #8416

* Fix style issues

* Apply suggestions from code review

Co-authored-by: Felix Fontein <felix@fontein.de>

* Fix indentation

* Add changelog fragment

* Apply suggestions from code review

Co-authored-by: Felix Fontein <felix@fontein.de>

* Updated as per code review recommendations

* Fix whitespace

* Add quiet option, fix logic, update changelog

* Fix trailing whitespace

* Update plugins/modules/zypper.py

Co-authored-by: Felix Fontein <felix@fontein.de>

* Add suggested improvements

---------

Co-authored-by: Eric Hoogeveen <eric.hoogeveen@ssc-spc.gc.ca>
Co-authored-by: Felix Fontein <felix@fontein.de>
(cherry picked from commit 825e0ee)

Co-authored-by: Eric <8869330+erichoog@users.noreply.github.com>
Massl123 pushed a commit to Massl123/community.general that referenced this pull request Feb 7, 2025
…sible-collections#9270)

* zypper: add simple_errors option -fixes ansible-collections#8416

* Fix style issues

* Apply suggestions from code review

Co-authored-by: Felix Fontein <felix@fontein.de>

* Fix indentation

* Add changelog fragment

* Apply suggestions from code review

Co-authored-by: Felix Fontein <felix@fontein.de>

* Updated as per code review recommendations

* Fix whitespace

* Add quiet option, fix logic, update changelog

* Fix trailing whitespace

* Update plugins/modules/zypper.py

Co-authored-by: Felix Fontein <felix@fontein.de>

* Add suggested improvements

---------

Co-authored-by: Eric Hoogeveen <eric.hoogeveen@ssc-spc.gc.ca>
Co-authored-by: Felix Fontein <felix@fontein.de>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
backport-10 Automatically create a backport for the stable-10 branch feature This issue/PR relates to a feature request module module new_contributor Help guide this first time contributor plugins plugin (any type)
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[Feature Request][zypper] Add parameter to simplify/reduce error output
3 participants