Bug 784158

Summary: spacewalk-service does not offer a way to disable some services, like taskomatic when setting Redundant Spacewalk with Stand-Alone DB
Product: [Community] Spacewalk Reporter: Marcelo Moreira de Mello <mmello>
Component: ServerAssignee: Jan Pazdziora <jpazdziora>
Status: CLOSED CURRENTRELEASE QA Contact: Red Hat Satellite QA List <satqe-list>
Severity: medium Docs Contact:
Priority: medium    
Version: 1.7CC: jpazdziora, mmello
Target Milestone: ---   
Target Release: ---   
Hardware: All   
OS: Linux   
Whiteboard:
Fixed In Version: spacewalk-admin-1.7.3-1 Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: 784139 Environment:
Last Closed: 2012-03-07 09:54:10 UTC Type: ---
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Bug Depends On:    
Bug Blocks: 765736    
Attachments:
Description Flags
patch [1/3]
none
patch [2/3]
none
patch [3/3] none

Description Marcelo Moreira de Mello 2012-01-24 02:50:25 UTC
+++ This bug was initially created as a clone of Bug #784139 +++

Description of problem:

rhn-satellite does not offer a way to disable some services, like taskomatic when setting Redundant Satellites with Stand-Alone DB

According with documentation available at RHN docs [1], taskomatic must be disabled into redundant environments. 

[1] - http://docs.redhat.com/docs/en-US/Red_Hat_Network_Satellite/5.4/html-single/Installation_Guide/index.html#sect-Installation_Guide-Maintenance-Establishing_Redundant_Satellites_with_Stand_Alone_DB

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

How reproducible:
100%

Steps to Reproduce:
1. restart rhn-satellite  # rhn-satellite restart

  
Actual results:

 # rhn-satellite restart all services


Expected results:

  rhn-satellite should read a config file to determine which service will be started

--- Additional comment from mmello on 2012-01-23 21:03:19 BRST ---


  Hello team, 

 Reading the code it seems that rhn-satellite script already have the capability to ignore some services, look below: 


151 OPTS=$(getopt --longoptions=exclude:,level: -n ${0##*/} -- e:l: "$@")
152 
153 if [ $? != 0 ] ; then echo "Terminating..." >&2 ; exit 1 ; fi
154 
155 eval set -- "$OPTS"
156 
157 while true ; do
158     case "$1" in
159         -e|--exclude)
160             EXCLUDE=$2
161             shift
162             # the space in "$SERVICE " is intentional, don't remove it.
163             SERVICES=$(while read -d " " service ; do echo ${service/$EXCLUDE}; done <<<"$SERVICES ")
164             ;;
165         -l|--level)
166             LEVEL="--level $2"
167             shift
168             ;;
169         --)
170             shift
171             break
172             ;;
173         *)
174             echo "Internal error!" >&2
175             exit 1
176             ;;
177     esac
178     shift
179 done




[root@dhcp85 ~]# rhn-satellite --exclude taskomatic restart
Shutting down spacewalk services...
Stopping cobbler daemon:                                   [  OK  ]
Stopping rhn-search...
Stopped rhn-search.
Stopping MonitoringScout ...  
[ OK ]
Stopping Monitoring ...  
[ OK ]
Stopping httpd:                                            [  OK  ]
Stopping tomcat6:                                          [  OK  ]
Shutting down osa-dispatcher:                              [  OK  ]
Shutting down Oracle Net Listener ...                      [  OK  ]
Shutting down Oracle DB instance "rhnsat" ...              [  OK  ]
Terminating jabberd processes ...
Stopping router:                                           [  OK  ]
Stopping sm:                                               [  OK  ]
Stopping c2s:                                              [  OK  ]
Stopping s2s:                                              [  OK  ]
Done.
Starting spacewalk services...
Initializing jabberd processes ...
Starting router:                                           [  OK  ]
Starting sm:                                               [  OK  ]
Starting c2s:                                              [  OK  ]
Starting s2s:                                              [  OK  ]
Starting Oracle Net Listener ...                           [  OK  ]
Starting Oracle DB instance "rhnsat" ...                   [  OK  ]
Starting osa-dispatcher:                                   [  OK  ]
Starting tomcat6:                                          [  OK  ]
Starting httpd:                                            [  OK  ]
Starting Monitoring ...  
[ OK ]
Starting MonitoringScout ...  
[ OK ]
Starting rhn-search...
Starting cobbler daemon: SERVING!
                                                           [  OK  ]
Done.

+++++++++++++++++++++++++++++++

  We can use this to create a tunable flag to automate the service 

Best, 
mmello

Comment 1 Marcelo Moreira de Mello 2012-01-24 02:51:21 UTC

 Taking..

Comment 2 Marcelo Moreira de Mello 2012-01-24 03:28:38 UTC
Created attachment 557109 [details]
patch [1/3]

Hello, 

Here follow 3 patches which includes a capability to Spacewalk ignore to start some services when running the /usr/sbin/spacewalk-service script.

Below is an example after applied the patch excluding the Taskomatic service to be started:

# cat /etc/rhn/disabled-services
DISABLED_SERVICES="taskomatic"

# spacewalk-service  start
Starting spacewalk services...
Initializing jabberd processes ...
Starting router:                                           [  OK  ]
Starting sm:                                               [  OK  ]
Starting c2s:                                              [  OK  ]
Starting s2s:                                              [  OK  ]
Starting Oracle Net Listener ...                           [  OK  ]
Starting Oracle DB instance "rhnsat" ...                   [  OK  ]
Starting osa-dispatcher:                                   [  OK  ]
Starting tomcat6:                                          [  OK  ]
Starting httpd:                                            [  OK  ]
Starting Monitoring ...
[ OK ]
Starting MonitoringScout ...
[ OK ]
Starting rhn-search...
Starting cobbler daemon: SERVING!
                                                           [  OK  ]
Done.

# spacewalk-service status
router (pid 20117) is running...
sm (pid 20124) is running...
c2s (pid 20131) is running...
s2s (pid 20138) is running...
Oracle Net Listener (pid 20189) is running...
Oracle DB instance rhnsat (pid 20201) is running...
osa-dispatcher (pid  20245) is running...
tomcat6 (pid 20316) is running...                          [  OK  ]
httpd (pid  20339) is running...
rhn-search is running (20386).
cobblerd (pid 20421) is running...

# /etc/init.d/taskomatic status
RHN Taskomatic is not running.

 Patch already sent to approval at spacewalk-devel mailing list at 
https://www.redhat.com/archives/spacewalk-devel/2012-January/msg00056.html

Best, 
Marcelo Moreira de Mello

Comment 3 Marcelo Moreira de Mello 2012-01-24 03:29:09 UTC
Created attachment 557110 [details]
patch [2/3]

Comment 4 Marcelo Moreira de Mello 2012-01-24 03:29:35 UTC
Created attachment 557111 [details]
patch [3/3]

Comment 5 Jan Pazdziora 2012-02-03 13:49:53 UTC
I've ended up adding support for file /etc/rhn/service-list where you can manipulate the $SERVICES list in any way, or override it completely.

In Spacewalk master, 5ed8779d0e1e4b8e4b73c4f273bdbd934a08472b.

Comment 6 Jan Pazdziora 2012-03-07 09:54:10 UTC
Spacewalk 1.7 has been released:

https://fedorahosted.org/spacewalk/wiki/ReleaseNotes17