Bug 1526375
| Summary: | tendrl-api rpm %post, %preun, %postun scripts should correctly handle systemd service | ||
|---|---|---|---|
| Product: | [Red Hat Storage] Red Hat Gluster Storage | Reporter: | Daniel Horák <dahorak> |
| Component: | web-admin-tendrl-api | Assignee: | Shirshendu Mukherjee <smukherj> |
| Status: | CLOSED ERRATA | QA Contact: | Daniel Horák <dahorak> |
| Severity: | unspecified | Docs Contact: | |
| Priority: | unspecified | ||
| Version: | rhgs-3.3 | CC: | nthomas, rhs-bugs, smukherj |
| Target Milestone: | --- | ||
| Target Release: | RHGS 3.4.0 | ||
| Hardware: | Unspecified | ||
| OS: | Unspecified | ||
| Whiteboard: | |||
| Fixed In Version: | tendrl-ansible-1.6.1-2.el7rhgs.noarch.rpm, tendrl-api-1.6.1-1.el7rhgs.noarch.rpm, tendrl-commons-1.6.1-1.el7rhgs.noarch.rpm, tendrl-monitoring-integration-1.6.1-1.el7rhgs.noarch.rpm, tendrl-node-agent-1.6.1-1.el7, tendrl-ui-1.6.1-1.el7rhgs.noarch.rpm, | Doc Type: | If docs needed, set a value |
| Doc Text: | Story Points: | --- | |
| Clone Of: | Environment: | ||
| Last Closed: | 2018-09-04 07:00:31 UTC | Type: | Bug |
| Regression: | --- | Mount Type: | --- |
| Documentation: | --- | CRM: | |
| Verified Versions: | Category: | --- | |
| oVirt Team: | --- | RHEL 7.3 requirements from Atomic Host: | |
| Cloudforms Team: | --- | Target Upstream Version: | |
| Embargoed: | |||
| Bug Depends On: | |||
| Bug Blocks: | 1503134 | ||
Tested and verified with:
tendrl-api-1.6.3-3.el7rhgs.src.rpm
The specfile now contains expected macros:
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
%post
%systemd_post tendrl-api.service
%preun
%systemd_preun tendrl-api.service
%postun
%systemd_postun_with_restart tendrl-api.service
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
And they are correctly expanded to post/preun/postun scripts:
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# rpm -q tendrl-api --scripts
<<truncated>>
postinstall scriptlet (using /bin/sh):
if [ $1 -eq 1 ] ; then
# Initial installation
systemctl preset tendrl-api.service >/dev/null 2>&1 || :
fi
preuninstall scriptlet (using /bin/sh):
if [ $1 -eq 0 ] ; then
# Package removal, not upgrade
systemctl --no-reload disable tendrl-api.service > /dev/null 2>&1 || :
systemctl stop tendrl-api.service > /dev/null 2>&1 || :
fi
postuninstall scriptlet (using /bin/sh):
systemctl daemon-reload >/dev/null 2>&1 || :
if [ $1 -ge 1 ] ; then
# Package upgrade, not uninstall
systemctl try-restart tendrl-api.service >/dev/null 2>&1 || :
fi
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Also case with uninstalling tendrl-api and trying to get status of tendrl-api
service fails with correct error:
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# systemctl status tendrl-api
Unit tendrl-api.service could not be found.
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
>> VERIFIED
Since the problem described in this bug report should be resolved in a recent advisory, it has been closed with a resolution of ERRATA. For information on the advisory, and where to find the updated files, follow the link below. If the solution does not work for you, open a new bug report. https://access.redhat.com/errata/RHSA-2018:2616 |
Description of problem: Spec file for tendrl-api package doesn't contain any %post, %preun and %postun scripts to notify systemd about the performed changes. So for example, after uninstalling tendrl-api, `systemctl status tendrl-api` command return: Failed to get properties: Access denied instead of expected: Unit tendrl-api.service could not be found. And there are some other situations when the systemd is in slightly inconsistent state after install/uninstall of tendrl-api package. Version-Release number of selected component (if applicable): tendrl-api-1.5.4-4.el7rhgs.noarch Actual results: tendrl-api.spec file doesn't contain any pre/post in/uninstall scripts to notify systemd about the changes Expected results: tendrl-api.spec file should contain required pre/post in/uninstall scripts to notify systemd about the changes Additional info: For example (and for inspiration), httpd.spec file contains following definitions: ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ %post %systemd_post httpd.service htcacheclean.service %preun %systemd_preun httpd.service htcacheclean.service %postun %systemd_postun ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~