Skip to content

Add pkg.services_need_restart - #58262

Merged
Ch3LL merged 7 commits into
saltstack:masterfrom
agraul:pgk-list-outdated-services
Mar 4, 2021
Merged

Add pkg.services_need_restart#58262
Ch3LL merged 7 commits into
saltstack:masterfrom
agraul:pgk-list-outdated-services

Conversation

@agraul

@agraul agraul commented Aug 21, 2020

Copy link
Copy Markdown
Contributor

What does this PR do?

Add pkg.services_need_restarting to Zypper, Yum(DNF) and Apt.

Current name proposal is pkg.services_need_restarting, but I don't mind changing the name to a better one if suggested.

What issues does this PR fix or reference?

Fixes: #58261

New Behavior

server:~ # salt 192.168.100.194 pkg.services_need_restarting
192.168.100.194:
    - salt-minion
    - qemu-guest-agent
    - sssd
    - polkit
    - gssproxy
    - getty@tty1
    - firewalld
    - NetworkManager
    - ModemManager

Merge requirements satisfied?

Commits signed with GPG?

Yes (always ;))

@agraul agraul changed the title Pgk list outdated services Add pkg.list_outdated_services Aug 21, 2020
Comment thread salt/utils/systemd.py Outdated
@agraul
agraul force-pushed the pgk-list-outdated-services branch 4 times, most recently from 3e2c295 to 0db9e0c Compare September 16, 2020 14:28
@agraul agraul changed the title Add pkg.list_outdated_services Add pkg.services_need_restarting Sep 16, 2020
@agraul
agraul force-pushed the pgk-list-outdated-services branch from dbad856 to e3c8f19 Compare September 16, 2020 14:40
@agraul
agraul marked this pull request as ready for review September 16, 2020 14:44
@agraul
agraul requested a review from a team as a code owner September 16, 2020 14:44
@ghost
ghost requested review from waynew and removed request for a team September 16, 2020 14:44
@agraul
agraul force-pushed the pgk-list-outdated-services branch 2 times, most recently from 8b096dc to ddae832 Compare September 16, 2020 15:26
@agraul

agraul commented Sep 16, 2020

Copy link
Copy Markdown
Contributor Author

I'll fix the CI complains due to the Python2 removal and push the changes asap, hopefully tomorrow.

@agraul
agraul force-pushed the pgk-list-outdated-services branch 4 times, most recently from 9bcb85c to 3af77bc Compare September 17, 2020 17:49
Comment thread salt/modules/zypperpkg.py Outdated
@agraul
agraul force-pushed the pgk-list-outdated-services branch 7 times, most recently from a9036bb to d41a37d Compare September 18, 2020 13:49
@agraul
agraul force-pushed the pgk-list-outdated-services branch 3 times, most recently from 771991d to ce52020 Compare September 29, 2020 08:45
@sagetherage sagetherage added the Feature new functionality including changes to functionality and code refactors, etc. label Dec 14, 2020
@sagetherage
sagetherage requested review from bryceml and removed request for bryceml December 14, 2020 23:44
@agraul
agraul force-pushed the pgk-list-outdated-services branch 3 times, most recently from 74a900a to e5b24fb Compare December 17, 2020 10:42
@agraul
agraul force-pushed the pgk-list-outdated-services branch 2 times, most recently from b240ffa to 6ce02c7 Compare January 13, 2021 16:10
@agraul
agraul force-pushed the pgk-list-outdated-services branch from 6ce02c7 to 731b477 Compare January 25, 2021 11:32
OrangeDog added a commit to OrangeDog/salt that referenced this pull request Feb 2, 2021
Unfortunately the virtual package must be manually resolved.

Also note PR saltstack#58262 is implementing the service restart checks.
It is arguable whether it should be included, as technically you do not need
 a full reboot.
Comment thread salt/modules/aptpkg.py Outdated
@agraul
agraul force-pushed the pgk-list-outdated-services branch from 731b477 to a9369b0 Compare February 12, 2021 12:12
@Ch3LL Ch3LL added the merge-conflict PR has a merge conflict label Feb 16, 2021
@agraul
agraul force-pushed the pgk-list-outdated-services branch from a9369b0 to 0cecb75 Compare February 24, 2021 20:33
@Ch3LL Ch3LL removed the merge-conflict PR has a merge conflict label Feb 25, 2021

@Ch3LL Ch3LL left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

One small change. I would love to get this into 3003, but we will be tagging any day now so I cannot guarantee this.

Comment thread salt/modules/aptpkg.py Outdated

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

this needs to be 3003

Comment thread salt/modules/yumpkg.py Outdated

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

3003

Comment thread salt/modules/zypperpkg.py Outdated

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

3003

agraul and others added 7 commits March 2, 2021 19:57
This function translates a given PID to the systemd service name in case
the process belongs to a running service. It uses DBUS for the
translation if DBUS is available, falling back to parsing
``systemctl status -o json'' output.
pkg.services_need_restart returns a list of system services that were
affected by package manager operations such as updates, downgrades or
reinstallations without having been restarted. This might cause issues,
e.g. in the case a shared object was loaded by a process and then
replaced by the package manager.
pkg.services_need_restart returns a list of system services that were
affected by package manager operations such as updates, downgrades or
reinstallations without having been restarted. This might cause issues,
e.g. in the case a shared object was loaded by a process and then
replaced by the package manager.

Requires checkrestart, which is part of the debian-goodies package and
available from official Ubuntu and Debian repositories.
pkg.services_need_restart returns a list of system services that were
affected by package manager operations such as updates, downgrades or
reinstallations without having been restarted. This might cause issues,
e.g. in the case a shared object was loaded by a process and then
replaced by the package manager.

Requires dnf with the needs-restarting plugin, which is part of
dnf-plugins-core and installed by default on RHEL/CentOS/Fedora.
Also requires systemd for the mapping between PIDs and systemd services.
Co-authored-by: Wayne Werner <waynejwerner@gmail.com>
@agraul
agraul force-pushed the pgk-list-outdated-services branch from 0cecb75 to d89a3e8 Compare March 2, 2021 18:59
@agraul

agraul commented Mar 2, 2021

Copy link
Copy Markdown
Contributor Author

@Ch3LL good catch! I've changed the NEXT to 3003 in all three pkg modules

@Ch3LL
Ch3LL merged commit 3fc492f into saltstack:master Mar 4, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Aluminium Release Post Mg and Pre Si Feature new functionality including changes to functionality and code refactors, etc.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[FEATURE REQUEST] Ability to list system services that were affected by package manager operations

8 participants