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

needs-restarting: Add --exclude-services #556

Conversation

evan-goode
Copy link
Member

For consumers of dnf4 needs-restarting's output, it's useful to separate the systemd services needing restart vs. the processes not managed by systemd that need restarting. This new dnf4 needs-restarting --exclude-services ONLY prints information about processes NOT managed by systemd, and for listing systemd services that need to be restarted, the existing --services flag can be used.

When both --services and --exclude-services are passed --exclude-services is ignored.

For https://issues.redhat.com/browse/RHEL-56137.

CI PR on the way.

@evan-goode evan-goode force-pushed the evan-goode/needs-restarting-not-services branch from cb57c07 to 1cd6d32 Compare September 24, 2024 21:53
@evan-goode
Copy link
Member Author

@martinpitt would you mind reviewing this to see whether it would work for you?

Copy link

@martinpitt martinpitt left a comment

Choose a reason for hiding this comment

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

Thanks @evan-goode ! This looks correct and provides what we need for dnf4.

@evan-goode
Copy link
Member Author

Hmm, I guess our ci-dnf-stack test suite is not really prepared to test this functionality (it doesn't test dnf4 needs-restarting --services either) since it runs in a systemd-less container. We will want to update our Beaker tests for this. Marking as RFR.

@evan-goode evan-goode marked this pull request as ready for review September 25, 2024 19:58
plugins/needs_restarting.py Outdated Show resolved Hide resolved
For consumers of `dnf4 needs-restarting`'s output, it's useful to
separate the systemd services needing restart vs. the processes not
managed by systemd that need restarting. This new `dnf4 needs-restarting
--exclude-services` ONLY prints information about processes NOT managed
by systemd, and for listing systemd services that need to be restarted,
the existing `--services` flag can be used.

When both `--services` and `--exclude-services` are passed
`--exclude-services` is ignored.

For https://issues.redhat.com/browse/RHEL-56137.
@evan-goode evan-goode force-pushed the evan-goode/needs-restarting-not-services branch from e05dff9 to 6977682 Compare October 2, 2024 18:54
Comment on lines +323 to +324
if not self.opts.exclude_services:
stale_pids.add(pid)
Copy link
Contributor

Choose a reason for hiding this comment

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

I didn't realize this before but now that the --services option prints only stale_service_names there is no point in adding to the stale_pids when --services is set right?

Copy link
Member Author

Choose a reason for hiding this comment

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

I suppose, but I think it's fine to leave it.

@glum23
Copy link

glum23 commented Oct 3, 2024

The PR has been tested downstream in RHEL, everything passed.

@glum23
Copy link

glum23 commented Oct 3, 2024

The PR has also been tested in Fedora40, everything passed. I'd say it's possible to merge the PR.

@kontura kontura merged commit d948fd8 into rpm-software-management:master Oct 4, 2024
3 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants