Hi,

On Wed, Dec 29, 2010 at 03:32:47PM +0100, Raoul Bhatia [IPAX] wrote:
> hi,
> 
> i today stumbled across a problem in the external/rackpdu stonith
> plugin:
> 
> my outlets are named:
> 
> > iso.3.6.1.4.1.318.1.1.12.3.3.1.1.2.1 = STRING: "Outlet 1 XL"
> > iso.3.6.1.4.1.318.1.1.12.3.3.1.1.2.2 = STRING: "b"
> > iso.3.6.1.4.1.318.1.1.12.3.3.1.1.2.3 = STRING: "m"
> > iso.3.6.1.4.1.318.1.1.12.3.3.1.1.2.4 = STRING: "Outlet 17 XL"
> > iso.3.6.1.4.1.318.1.1.12.3.3.1.1.2.5 = STRING: "kxxxxxx xx - vienna1"
> > iso.3.6.1.4.1.318.1.1.12.3.3.1.1.2.6 = STRING: "l.i.a"
> > iso.3.6.1.4.1.318.1.1.12.3.3.1.1.2.7 = STRING: "w2"
> > iso.3.6.1.4.1.318.1.1.12.3.3.1.1.2.8 = STRING: "k"
> > iso.3.6.1.4.1.318.1.1.12.3.3.1.1.2.9 = STRING: "i"
> 
> rackpdu tries to get the names via snmp and then cycles each array
> to check which outlet to shoot:
> 
> > local names=`echo "$snmp_result" | cut -f2 -d'"' | tr ' ' '_' | tr '\012' ' 
> > '`
> 
> basically, this command cuts the string between the two "", replaces
> whitespaces with _ and replaces.
> 
> i get the following error:
> > # stonith -t external/rackpdu hostlist="w2" pduip=pdu.ipax.at community=abc 
> > -T reset w2
> > local: 280: kxxxxxx_xx_-_vienna1: bad variable name
> > external/rackpdu[30287]: ERROR: Outlet number not found for node w2. 
> > Result: iso.3.6.1.4.1.318.1.1.12.3.3.1.1.2.1 = STRING:
> > ...
> > ...
> 
> all in all, i found two problematic lines in my setup which both
> generate such an error.
> >> iso.3.6.1.4.1.318.1.1.12.3.3.1.1.2.5 = STRING: "kxxxxxx xx - vienna1"
> >> iso.3.6.1.4.1.318.1.1.12.3.3.1.1.2.6 = STRING: "l.i.a"
> 
> 
> rackpdu uses /bin/sh (which is dash 0.5.5.1-7.4 on debian squeeze).
> changing /bin/sh to /bin/bash solves this issue.
> 
> upon investigation, i found
> http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=598239
> 
> i changed the offending line:
> -local names=`echo "$snmp_result" | cut -f2 -d'"' | tr ' ' '_' | tr
> '\012' ' '`
> +local names="`echo \"$snmp_result\" | cut -f2 -d'\"' | tr ' ' '_' | tr
> '\012' ' '`"
> 
> this solves the issue for dash. please find sample scripts attached.
> 
> is there any better way to solve this issue?

What seems to me the best is to simply avoid the issue and do:

        local names
        names=`echo "$snmp_result" | cut -f2 -d'"' | tr ' ' '_' | tr '\012' ' '`

Does that work for dash?

Thanks for investigating!

Dejan

> thanks,
> raoul
> -- 
> ____________________________________________________________________
> DI (FH) Raoul Bhatia M.Sc.          email.          r.bha...@ipax.at
> Technischer Leiter
> 
> IPAX - Aloy Bhatia Hava OG          web.          http://www.ipax.at
> Barawitzkagasse 10/2/2/11           email.            off...@ipax.at
> 1190 Wien                           tel.               +43 1 3670030
> FN 277995t HG Wien                  fax.            +43 1 3670030 15
> ____________________________________________________________________



> _______________________________________________________
> Linux-HA-Dev: Linux-HA-Dev@lists.linux-ha.org
> http://lists.linux-ha.org/mailman/listinfo/linux-ha-dev
> Home Page: http://linux-ha.org/

_______________________________________________________
Linux-HA-Dev: Linux-HA-Dev@lists.linux-ha.org
http://lists.linux-ha.org/mailman/listinfo/linux-ha-dev
Home Page: http://linux-ha.org/

Reply via email to