Bug 1084836

Summary: pulp-server init script returns wrong exit code with 'status' argument when it's stopped
Product: Red Hat Update Infrastructure for Cloud Providers Reporter: Satoru SATOH <ssato>
Component: RHUAAssignee: RHUI Bug List <rhui-bugs>
Status: CLOSED ERRATA QA Contact: Irina Gulina <igulina>
Severity: medium Docs Contact:
Priority: unspecified    
Version: 2.1.3CC: cduryee, igulina, pcreech, tsanders
Target Milestone: ---   
Target Release: 3.0.0   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2017-03-01 22:08:08 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:
Attachments:
Description Flags
An experimental patch of /etc/rc.d/init.d/pulp-server
none
The patch for /etc/rc.d/init.d/pulp-server to make it compatible with LSB init script spec. none

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