Bug 1084836 - pulp-server init script returns wrong exit code with 'status' argument when it's stopped
Summary: pulp-server init script returns wrong exit code with 'status' argument when i...
Keywords:
Status: CLOSED ERRATA
Alias: None
Product: Red Hat Update Infrastructure for Cloud Providers
Classification: Red Hat
Component: RHUA
Version: 2.1.3
Hardware: Unspecified
OS: Unspecified
unspecified
medium
Target Milestone: ---
: 3.0.0
Assignee: RHUI Bug List
QA Contact: Irina Gulina
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2014-04-07 00:13 UTC by Satoru SATOH
Modified: 2017-03-01 22:08 UTC (History)
4 users (show)

Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Clone Of:
Environment:
Last Closed: 2017-03-01 22:08:08 UTC
Target Upstream Version:
Embargoed:


Attachments (Terms of Use)
An experimental patch of /etc/rc.d/init.d/pulp-server (1.32 KB, patch)
2014-04-07 00:13 UTC, Satoru SATOH
no flags Details | Diff
The patch for /etc/rc.d/init.d/pulp-server to make it compatible with LSB init script spec. (1.53 KB, patch)
2014-04-07 02:35 UTC, Satoru SATOH
no flags Details | Diff


Links
System ID Private Priority Status Summary Last Updated
Red Hat Product Errata RHBA-2017:0367 0 normal SHIPPED_LIVE Red Hat Update Infrastructure 3.0 Release 2017-03-02 03:05:22 UTC

Description Satoru SATOH 2014-04-07 00:13:34 UTC
Created attachment 883444 [details]
An experimental patch of /etc/rc.d/init.d/pulp-server

Description of problem: 
/etc/rc.d/init.d/pulp-server does not follow the LSB init script
spec [1] and returns wrong exit code (1) with 'status' argument passed
when the service is stopped (is not running). This causes trouble to
monitor the pulp-server service from outside.

[root@rhua ~]# service pulp-server stop
Stopping httpd:                                            [  OK  ]
Stopping Qpid AMQP daemon:                                 [  OK  ]
Stopping mongod:                                           [  OK  ]
[root@rhua ~]# service pulp-server status; echo $?
mongod is stopped
1
[root@rhua ~]#

[1] http://refspecs.linuxfoundation.org/LSB_4.1.0/LSB-Core-generic/LSB-Core-generic/iniscrptact.html


Version-Release number of selected component (if applicable):

[root@rhua ~]# rpm -qf /etc/rc.d/init.d/pulp-server
pulp-0.0.263-43.el6_5.noarch
[root@rhua ~]#


How reproducible: Always

Steps to Reproduce:
1. service pulp-server stop
2. service pulp-server status; echo $?

Actual results: pulp-server exits with the exit code '1' when stopped.

Expected results: It should exits with the exit code '3' (means stopped).

Additional info:

I wrote an experimental patch may fix this issue.

pulp-server is modified version and pulp-server.save is original
in the following:

[root@rhua ~]# service pulp-server status
mongod (pid 23606) is running...
httpd (pid  23646) is running...
qpidd (pid  23613) is running...
[root@rhua ~]# echo $?
0
[root@rhua ~]# service pulp-server stop
Stopping httpd:                                            [  OK  ]
Stopping Qpid AMQP daemon:                                 [  OK  ]
Stopping mongod:                                           [  OK  ]
[root@rhua ~]# service pulp-server status; echo $?
mongod is stopped
httpd is stopped
qpidd is stopped
3
[root@rhua ~]# /etc/rc.d/init.d/pulp-server.save status ; echo $?
mongod is stopped
1
[root@rhua ~]# /etc/rc.d/init.d/pulp-server help; echo $?
Usage: pulp-server {init|start|stop|status|restart}   # I don't think this is an error but I'm not sure.
0
[root@rhua ~]#

Comment 1 Satoru SATOH 2014-04-07 02:35:28 UTC
Created attachment 883445 [details]
The patch for /etc/rc.d/init.d/pulp-server to make it compatible with LSB init script spec.

I missed the explanation of the LSB init script spec [1],

  In case of an error while processing any init-script action except
  for status, the init script shall print an error message and exit
  with a non-zero status code:

  1	generic or unspecified error (current practice)
  2	invalid or excess argument(s)
  3	unimplemented feature (for example, "reload")
         ...

and updated the patch to make it comply with the above.

[1] http://refspecs.linuxfoundation.org/LSB_4.1.0/LSB-Core-generic/LSB-Core-generic/iniscrptact.html


Example session log of /etc/rc.d/init.d/pulp-server with the patch applied:

[root@rhua ~]# service pulp-server try-restart; echo $?
Not implemented: try-restart
3
[root@rhua ~]# service pulp-server reload; echo $?
Not implemented: reload
3
[root@rhua ~]# service pulp-server force-reload; echo $?
Not implemented: force-reload
3
[root@rhua ~]# service pulp-server monitor; echo $?
Usage: pulp-server {init|start|stop|status|restart}
2
[root@rhua ~]#

Comment 4 Patrick Creech 2016-06-16 18:31:25 UTC
This should be resolved by the newer pulp version in RHUI-3

Comment 5 Irina Gulina 2016-06-17 00:18:07 UTC
>> for i in httpd qpidd mongod; do systemctl stop $i; done
...
>> systemctl status httpd; echo $1
...
3
>> systemctl status qpidd; echo $1
...
3
>> systemctl status mongod; echo $1
...
3

Checked on RHUI3 iso 20160531

Comment 7 errata-xmlrpc 2017-03-01 22:08:08 UTC
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/RHBA-2017:0367


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