Bug 461747

Summary: rhn-proxy init script always gives 0 exit code
Product: [Community] Spacewalk Reporter: Rob James <rssjames>
Component: Proxy ServerAssignee: Miroslav Suchý <msuchy>
Status: CLOSED CURRENTRELEASE QA Contact: Red Hat Satellite QA List <satqe-list>
Severity: medium Docs Contact:
Priority: medium    
Version: 0.2CC: cperry, jpazdziora
Target Milestone: ---   
Target Release: ---   
Hardware: All   
OS: Linux   
Whiteboard:
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2009-09-17 07:01:20 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: 456551    
Attachments:
Description Flags
rhn-proxy init script patch none

Description Rob James 2008-09-10 12:24:38 UTC
Created attachment 316304 [details]
rhn-proxy init script patch

Currently the rhn-proxy init script returns 0 no matter what, e.g.:

# service rhn-proxy status
squid is stopped
squid: ERROR: No running copy
httpd is stopped
jabberd router is stopped
# echo $?
0

This patch adds a sensible exit code. It's not LSB compliant since services may have different error code (eg. squid may be "3" and httpd may be "1")

The patch also removes reload being an alias to restart so we don't pretend to implement something we don't. Finally, it also adds condrestart.

Comment 1 Miroslav Suchý 2008-09-11 13:37:25 UTC
I see  problem with this patch:

a) if proxy is not running and you do restart, then the stop action will fail and you carry on the non-zero further. This can be however resolved like:
restart() {
    stop
    RETVAL=0
    sleep 2
    start
}

I done it in commit 873614640c254905a4bd7059b5e3b561310824b7
where I done other minor fixing:
 - add LSB header to initscript and 
 - do not enable proxy if user previously disabled it

Comment 2 Jan Pazdziora 2008-11-05 09:40:04 UTC
The bugzilla is not clear whether it only concerns rhn-proxy status or also other rhn-proxy's activities but the example mentions rhn-proxy status, and that seems to return 0 when proxy is running and 1 when it is not. So moving to VERIFIED.

[root@vmware188 ~]# service rhn-proxy status
squid (pid 32669) is running...
httpd (pid 32717 32715 32714 32713 32712 32711 32710 32709 32690) is running...
jabberd router (pid 32730) is running...
[root@vmware188 ~]# echo $?
0
[root@vmware188 ~]# /etc/init.d/rhn-proxy stop
Shutting down rhn-proxy...
Shutting down Jabber router:                               [  OK  ]
Stopping httpd:                                            [  OK  ]
Stopping squid:                                            [  OK  ]
Done.
[root@vmware188 ~]# service rhn-proxy status
squid is stopped
squid: ERROR: No running copy
httpd is stopped
jabberd router is stopped
[root@vmware188 ~]# echo $?
1
[root@vmware188 ~]# /etc/init.d/rhn-proxy start
Starting rhn-proxy...
Starting squid: .                                          [  OK  ]
Starting httpd:                                            [  OK  ]
Starting Jabber services                                   [  OK  ]
Done.
[root@vmware188 ~]# service rhn-proxy status
squid (pid 505) is running...
httpd (pid 563 562 561 560 559 558 557 556 526) is running...
jabberd router (pid 567) is running...
[root@vmware188 ~]# echo $?
0
[root@vmware188 ~]# killall httpd
[root@vmware188 ~]# killall httpd
httpd: no process killed
[root@vmware188 ~]# service rhn-proxy status
squid (pid 505) is running...
httpd dead but subsys locked
jabberd router (pid 567) is running...
[root@vmware188 ~]# echo $?
1

Comment 3 Miroslav Suchý 2009-09-17 07:01:20 UTC
Spacewalk has been released for some time.