[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [hobbit] problem with CLASS definition (PATCH)
- To: hobbit (at) hswn.dk
 
- Subject: Re: [hobbit] problem with CLASS definition (PATCH)
 
- From: Charles Jones <jonescr (at) cisco.com>
 
- Date: Wed, 10 Oct 2007 12:00:08 -0700
 
- Authentication-results: sj-dkim-4; header.From=jonescr (at) cisco.com; dkim=pass (	sig from cisco.com/sjdkim4002 verified; ); 
 
- Dkim-signature: v=0.5; a=rsa-sha256; q=dns/txt; l=4325; t=1192042942; x=1192906942;	c=relaxed/simple; s=sjdkim4002;	h=Content-Type:From:Subject:Content-Transfer-Encoding:MIME-Version;	d=cisco.com; i=jonescr (at) cisco.com;	z=From:=20Charles=20Jones=20<jonescr (at) cisco.com>	|Subject:=20Re=3A=20[hobbit]=20problem=20with=20CLASS=20definition=20(PAT	CH)	|Sender:=20;	bh=RkrWZUErvRPXgd9Zdh8i4OsgHxa9wfq5X4Z+cKinnio=;	b=gR6Ye5WqhcVq/8yOFPj0OLnZEMxoKAgt97JTVGGqRZFM4Lfw3M2EkuYWTI2LZvYAPdeX1WBz	t5/vG9uy62hPKXRkdyAUh8zin9k/gF+7nusU6NOJbaEWeFYJOsbj3WEY;
 
- References: <4706C711.4030201 (at) cisco.com> <470D1348.3090405 (at) cisco.com> <470D1781.5070606 (at) cisco.com> <470D1E8C.7050403 (at) cisco.com>
 
- User-agent: Thunderbird 2.0.0.5 (X11/20070727)
 
Okay I came up with a workaround. The problem is that CONFIGCLASS gets 
reset to a default value (in hobbitclient.cfg). So, I created another 
variable, "CLASS". I then made a small mod to hobbitclient.sh that 
checks to see if CLASS got set to something, and if it did, it sets 
CONFIGCLASS to that value.  Here are the changes:
--- runclient.sh        2006-08-09 20:09:58.000000000 +0000
+++ /tmp/runclient.sh   2007-10-10 18:55:00.000000000 +0000
@@ -32,6 +32,7 @@
               ;;
         --class=*)
               CONFIGCLASS="`echo $1 | sed -e 's/--class=//' | tr 
'[A-Z]' '[a-z]'`"
+                CLASS=$CONFIGCLASS # Use a variable that doesn't get reset
               ;;
         --help)
               echo "Usage: $0 [--hostname=CLIENTNAME] 
[--os=rhel3|linux22] [--class=CLASSNAME] start|stop
"
@@ -61,7 +62,7 @@
MACHINE="`echo $MACHINEDOTS | sed -e 's/\./,/g'`"
-export MACHINE MACHINEDOTS BBOSTYPE BBOSSCRIPT HOBBITCLIENTHOME CONFIGCLASS
+export MACHINE MACHINEDOTS BBOSTYPE BBOSSCRIPT HOBBITCLIENTHOME 
CONFIGCLASS CLASS
case "$CMD" in
  "start")
@@ -128,6 +129,5 @@
       break;
esac
-
exit 0
-----
--- hobbitclient.sh     2006-08-09 20:09:58.000000000 +0000
+++ /tmp/hobbitclient.sh        2007-10-10 18:55:28.000000000 +0000
@@ -48,6 +48,9 @@
       echo "@@client#1|0|127.0.0.1|$MACHINEDOTS|$BBOSTYPE" >> $MSGTMPFILE
fi
+if [ -n "$CLASS" ]; then #If CLASS was set to something, override the 
default
+   CONFIGCLASS=$CLASS
+fi
echo "client $MACHINE.$BBOSTYPE $CONFIGCLASS"  >>  $MSGTMPFILE
$BBHOME/bin/$BBOSSCRIPT >> $MSGTMPFILE
# logfiles
Charles Jones wrote:
I also just discovered that CONFIGCLASS gets converted to lowercase 
(which I should have seen plain as day in the sed command). However 
this is not the problem as the CONFIGCLASS in the client message is 
still using the default value of BBOSTYPE.  I'm currently attempting 
to hack in a work around.
-Charles
Charles Jones wrote:
I did some poking around, and as far as I can tell, the problem is 
due to hobbitclient.cfg overriding the CONFIGCLASS variable.
Here are some snippets from runclient.sh:
--class=*)
               CONFIGCLASS="`echo $1 | sed -e 's/--class=//' | tr 
'[A-Z]' '[a-z]'`"
export MACHINE MACHINEDOTS BBOSTYPE BBOSSCRIPT HOBBITCLIENTHOME 
CONFIGCLASS
hobbitclient.cfg contains this:
./hobbitclient.cfg:CONFIGCLASS="$BBOSTYPE"         # Default 
configuration class for logfiles
hobbitclient.sh uses the CONFIGCLASS variable when sending the client 
message:
./bin/hobbitclient.sh:echo "client $MACHINE.$BBOSTYPE $CONFIGCLASS"  
>>  $MSGTMPFILE
Heres the actual client message header Im sending (not that 
CONFIGCLASS  is being set to "linux" instead of the specified class:
client host-app-23.linux linux
-Charles
Charles Jones wrote:
Anyone have any thoughts on this? I'm currently dead in the water 
without this working as it should.  I tried emailing Henrik as well 
but I'm sure he is too busy to reply.
-Charles
Charles Jones wrote:
I have a host whose client was started via: "./runclient.sh 
--class=APP_PRIMARY start"
In the hobbit servers hobbit-clients.cfg, I have something similar to:
CLASS=APP_PRIMARY
   PROC "someproc"
   PROC "/some/other/proc"
....
DEFAULT
   PROC sshd
The problem is that only the default proc "sshd" is being checked 
on the host.  The expected behavior is that the CLASS would be used 
and other other procs checked instead. I know this has nothing to 
do with the DEFAULT setting, as using HOST=hostname works fine. I 
just cant get it to check the procs by CLASS.  Is there any way to 
debug this?  Shouldn't the CLASS show up in the "info" section?  Do 
I need to put the class name in quotes on the command line?
To unsubscribe from the hobbit list, send an e-mail to
hobbit-unsubscribe (at) hswn.dk
To unsubscribe from the hobbit list, send an e-mail to
hobbit-unsubscribe (at) hswn.dk
To unsubscribe from the hobbit list, send an e-mail to
hobbit-unsubscribe (at) hswn.dk