-
Notifications
You must be signed in to change notification settings - Fork 120
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
fix: Restart rhsm service after installation #3485
base: main
Are you sure you want to change the base?
Conversation
* Card ID: CCT-1027 Following the installation of the subscription-manager package, the dbus service was not loaded as expected. This update addresses the problem by ensuring that the dbus service is properly restarted after the installation or upgrade process.
I am not sure about the failing test 😿. However, here is a setup how you can test this change:
#!/bin/bash
source ./library.sh
start_register_server
export username="admin"
export password="admin"
export org_id="content-sources-test"
echo "Trying to get list of organizations using dbus-send..."
dbus-send --address=${my_addr} --print-reply --dest='com.redhat.RHSM1.Register' \
'/com/redhat/RHSM1/Register' \
com.redhat.RHSM1.Register.GetEnvironments string:${username} \
string:${password} \
string:${org_id} \
dict:string:string:"","" \
string:""
stop_register_server |
@@ -681,6 +681,8 @@ find %{buildroot} -name \*.py* -exec touch -r %{SOURCE0} '{}' \; | |||
%tmpfiles_create %{_tmpfilesdir}/subscription-manager.conf | |||
%else | |||
%systemd_post rhsmcertd.service | |||
%systemd_post rhsm.service | |||
systemctl restart rhsm.service |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why do you call systemctl restart rhsm.service
? Why the macro %systemd_post rhsm.service
is not enough?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Tried that, didn't work
%systemd_post rhsm.service | ||
systemctl restart rhsm.service |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Reference of the RPM macros: https://github.com/systemd/systemd/blob/46f881e32127cce03118dcd0471ded12d08d50b2/src/rpm/macros.systemd.in
%systemd_post
in practice only installs the new service, and it does not do anything more than that
What seems to be needed here is %systemd_postun_with_restart
, which seems to be marking the unit as "needs to be restarted", and then the rpm file triggers will make systemd restart the units marked as "no be restarted". Please note that the right place for that is in %postun
, not %post
.
Following the installation of the subscription-manager package, the dbus service was not loaded as expected. This update addresses the problem by ensuring that the dbus service is properly restarted after the installation or upgrade process.