Bug 521656

Summary: openhpi-subagent returns wrong exit codes
Product: [Fedora] Fedora Reporter: Yulia Kopkova <ykopkova>
Component: openhpi-subagentAssignee: Dan Horák <dan>
Status: CLOSED RAWHIDE QA Contact: Fedora Extras Quality Assurance <extras-qa>
Severity: medium Docs Contact:
Priority: low    
Version: 12CC: dan, dkovalsk, pknirsch
Target Milestone: ---Keywords: Triaged
Target Release: ---   
Hardware: All   
OS: Linux   
Whiteboard:
Fixed In Version: openhpi-subagent-2.3.4-12.fc13 Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2010-02-23 17:25:58 UTC Type: ---
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: 521669    

Description Yulia Kopkova 2009-09-07 13:22:15 UTC
Description of problem:
According to https://fedoraproject.org/wiki/FCNewInit/Initscripts openhpi-subagent service should:
1) return exit code 3 if run with unimplemented feature;
2) return exit code 2 if program is dead and /var/lock/subsys/openhpi-subagent file exists
3) know force-reload option

The reason of filling this is "InitScripts LSB compliance project"


Version-Release number of selected component (if applicable):
openhpi-2.14.0-5.fc12.x86_64
openhpi-subagent-2.3.4-7.fc12.x86_64


How reproducible:
Always

Steps to Reproduce:
1.# service openhpi-subagent unknown ; echo $?

2.# service openhpi-subagent force-reload ; echo $?

3.# service openhpi-subagent stop
  # touch /var/lock/subsys/openhpi-subagent
  # service openhpi-subagent status ; echo $?

Actual results:
1. Usage: /etc/init.d/openhpi-subagent {start|stop|status|restart|condrestart|reload}
1

2. Usage: /etc/init.d/openhpi-subagent {start|stop|status|restart|condrestart|reload}
1

3. hpiSubagent is stopped
3

Expected results:
1. Usage: /etc/init.d/openhpi-subagent {start|stop|status|restart|condrestart|reload}
3

2. Stopping openhpi-subagent:                              [  OK  ]
Starting openhpi-subagent:                                 [  OK  ]
0

3. hpiSubagent dead but subsys locked
2


Additional info:

Comment 4 Yulia Kopkova 2009-09-17 11:31:34 UTC
One more thing that need to be fixed 

Init script should also return code "4" if restarting service under
nonprivileged user:

su testuserqa -c "service $SERVICE restart"; echo $?
now: 0 
expected: 4

Comment 5 Yulia Kopkova 2009-09-24 15:38:45 UTC
(In reply to comment #0)

Update:

> 1) return exit code 3 if run with unimplemented feature;

return exit code "2" if run with unimplemented feature;


service openhpi-subagent unknown ; echo $?
Usage: /etc/init.d/openhpi-subagent
{start|stop|status|restart|condrestart|reload}
2

Comment 6 Bug Zapper 2009-11-16 12:01:04 UTC
This bug appears to have been reported against 'rawhide' during the Fedora 12 development cycle.
Changing version to '12'.

More information and reason for this action is here:
http://fedoraproject.org/wiki/BugZappers/HouseKeeping

Comment 8 Dan Horák 2010-02-08 14:47:13 UTC
(In reply to comment #0)
> 2) return exit code 2 if program is dead and /var/lock/subsys/openhpi-subagent
> file exists

This feature requires a pidfile created by the agent, but the agent doesn't support it. The other 2 bugs will be fixed in the next package revision.

Comment 9 Yulia Kopkova 2010-02-08 15:06:06 UTC
Ok, np

Comment 10 Dan Horák 2010-02-23 17:25:58 UTC
(In reply to comment #8)
> (In reply to comment #0)
> > 2) return exit code 2 if program is dead and /var/lock/subsys/openhpi-subagent
> > file exists
> 
> This feature requires a pidfile created by the agent, but the agent doesn't
> support it. The other 2 bugs will be fixed in the next package revision.    

I was able to get it work too with proper command line options given to the status function.