#12397 investigate using libdnf5-plugin-actions for f41+/wsgi hosts
Closed: Fixed with Explanation by kevin. Opened by kevin.

We have a number of f41+ vm's that are using mod_wsgi for their application and when dnf-automatic updates python, things go south until httpd is restarted.

So, we should look at using dnf5's action plugins to see if python was updated, if it was, restart httpd.

man libdnf5-actions has info about this. I imagine it would be:

  • Some local testing to find a action file that works as we want
  • identify the wsgi using vm's
  • adding libdnf5-actions to be installed on those vm's
  • adding the action file to actions.d/
  • profit

Metadata Update from @phsmoura:
- Issue priority set to: Waiting on Assignee (was: Needs Review)
- Issue tagged with: low-trouble, medium-gain, ops

Metadata Update from @james:
- Issue assigned to james

% cat python3-mod_wsgi.actions
# Requirements: yum install libdnf5-plugin-actions
# At the end of the DNF transaction
#    if python3-mod_wsgi has (re)installed/(up|down)graded then
#        restart HTTPD
# Doesn't do anything if python3-mod_wsgi is removed.
post_transaction:python3-mod_wsgi:in:enabled=host-only:/bin/systemctl try-restart --no-block httpd.service htcacheclean.service
# Uncomment this line to do the same thing when it's removed
#  (will restart twice on (up/down)grades)
# post_transaction:python3-mod_wsgi:out:enabled=host-only:/bin/systemctl try-restart --no-block httpd.service htcacheclean.service

I tested the above in a container, and it seems to work fine (does things when that package is upgraded/downgraded and nothing when not).

Technically we could just drop this file into /etc/dnf/libdnf5-plugins/actions.d/ (and install libdnf5-plugin-actions) in every VM (or some super set). LMK.

It's actually python3 itself that causes the problem (although perhaps mod_wsgi would too? it doesn't update nearly as much as python)

python-unversioned-command-3.13.2-1.fc41.noarch Mon 10 Feb 2025 06:23:11 AM UTC
python3-libs-3.13.2-1.fc41.x86_64             Mon 10 Feb 2025 06:23:11 AM UTC
python3-3.13.2-1.fc41.x86_64                  Mon 10 Feb 2025 06:23:11 AM UTC

Ahh, I added python3-libs as well then ... also opened a PR with the package:

https://src.fedoraproject.org/rpms/mod_wsgi/pull-request/19

Cool. Thanks!

In the mean time, perhaps we could just drop in a conf to do this on the machines we have that need it in ansible now/?

Thats ipsilon and koji at least. Possibly others...

I assume this should get all of the servers we can fix:

https://pagure.io/fedora-infra/ansible/pull-request/2477

PR merged. :) Hopefully we are all set.

Metadata Update from @kevin:
- Issue close_status updated to: Fixed with Explanation
- Issue status updated to: Closed (was: Open)

Metadata