Hi

when the "ping" RA configured as

primitive ping ocf:pacemaker:ping <snip> timeout="5s" <snip>

it throws

 [: 5s: integer expression expected

This patch fixes configurations where timeout is configured with a unit
following the number.

hth
Dominik
exporting patch:
# HG changeset patch
# User Dominik Klein <d...@in-telegence.net>
# Date 1302688701 -7200
# Node ID 7cc4a145240619f66ce3b2ac29bc5d05875f6bc8
# Parent  3b65a4d0e6ce25949e380d834e661450cc2c8d8a
low: ping RA: Make timeouts configured with unit work

diff -r 3b65a4d0e6ce -r 7cc4a1452406 extra/resources/ping
--- a/extra/resources/ping	Mon Apr 11 20:48:21 2011 +0200
+++ b/extra/resources/ping	Wed Apr 13 11:58:21 2011 +0200
@@ -253,21 +253,26 @@
 : ${OCF_RESKEY_CRM_meta_interval="10"}
 : ${OCF_RESKEY_CRM_meta_globally_unique:="true"}
 
-if [ -z ${OCF_RESKEY_timeout} ]; then
+# timeout is allowed to be "<number><unit>"
+timeout=`echo ${OCF_RESKEY_timeout} | egrep -o '[0-9]*'`
+if [ -z ${timeout} ]; then
     if [ x"$OCF_RESKEY_host_list" != x ]; then
 	host_count=`echo $OCF_RESKEY_host_list | awk '{print NF}'`
-	OCF_RESKEY_timeout=`expr $OCF_RESKEY_CRM_meta_timeout / $host_count / $OCF_RESKEY_attempts`
+	metatimeout=`echo ${OCF_RESKEY_CRM_meta_timeout} | egrep -o '[0-9]*'`
+	OCF_RESKEY_timeout=`expr $metatimeout / $host_count / $OCF_RESKEY_attempts`
 	OCF_RESKEY_timeout=`expr $OCF_RESKEY_timeout / 1100` # Convert to seconds and finish 10% early
     else
 	OCF_RESKEY_timeout=5
     fi
 fi
 
-if [ ${OCF_RESKEY_timeout} -lt 1 ]; then
+if [ ${timeout} -lt 1 ]; then
     OCF_RESKEY_timeout=5
-elif [ ${OCF_RESKEY_timeout} -gt 1000 ]; then
+elif [ ${timeout} -gt 1000 ]; then
     # ping actually complains if this value is too high, 5 minutes is plenty
     OCF_RESKEY_timeout=300
+else
+    OCF_RESKEY_timeout=${timeout}
 fi
 
 if [ ${OCF_RESKEY_CRM_meta_globally_unique} = "false" ]; then
_______________________________________________
Pacemaker mailing list: Pacemaker@oss.clusterlabs.org
http://oss.clusterlabs.org/mailman/listinfo/pacemaker

Project Home: http://www.clusterlabs.org
Getting started: http://www.clusterlabs.org/doc/Cluster_from_Scratch.pdf
Bugs: http://developerbugs.linux-foundation.org/enter_bug.cgi?product=Pacemaker

Reply via email to