Bugzilla will be upgraded to version 5.0. The upgrade date is tentatively scheduled for 2 December 2018, pending final testing and feedback.
Bug 1526375 - tendrl-api rpm %post, %preun, %postun scripts should correctly handle systemd service
tendrl-api rpm %post, %preun, %postun scripts should correctly handle systemd...
Status: CLOSED ERRATA
Product: Red Hat Gluster Storage
Classification: Red Hat
Component: web-admin-tendrl-api (Show other bugs)
3.3
Unspecified Unspecified
unspecified Severity unspecified
: ---
: RHGS 3.4.0
Assigned To: Shirshendu Mukherjee
Daniel Horák
:
Depends On:
Blocks: 1503134
  Show dependency treegraph
 
Reported: 2017-12-15 05:04 EST by Daniel Horák
Modified: 2018-09-04 03:01 EDT (History)
3 users (show)

See Also:
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 03:00:31 EDT
Type: Bug
Regression: ---
Mount Type: ---
Documentation: ---
CRM:
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---


Attachments (Terms of Use)


External Trackers
Tracker ID Priority Status Summary Last Updated
Github Tendrl/api/issues/378 None None None 2018-03-08 04:11 EST
Red Hat Product Errata RHSA-2018:2616 None None None 2018-09-04 03:01 EDT

  None (edit)
Description Daniel Horák 2017-12-15 05:04:55 EST
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
  ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Comment 2 Daniel Horák 2018-05-11 03:37:15 EDT
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
Comment 4 errata-xmlrpc 2018-09-04 03:00:31 EDT
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

Note You need to log in before you can comment on or make changes to this bug.