From 00c4cc6d2287edb10f82e47afbf1e97f24d78eb2 Mon Sep 17 00:00:00 2001 From: Martin Schwenke Date: Tue, 28 Jun 2011 16:10:23 +1000 Subject: Eventscripts: 10.interfaces clean-up - use more descriptive variable names. The name of variable $ok gives no clue to its meaning/use so this changes that variable to be named $up_interfaces_found. The return logic relating to $ok and $fail is difficult to read, so these variables are given true/fale values, allowing the return logic to be simplified. Signed-off-by: Martin Schwenke (This used to be ctdb commit 3402930319d462eab5525410f6a676952e120182) --- ctdb/config/events.d/10.interface | 18 +++++++----------- 1 file changed, 7 insertions(+), 11 deletions(-) diff --git a/ctdb/config/events.d/10.interface b/ctdb/config/events.d/10.interface index a82e4295dd..207a9d38ca 100755 --- a/ctdb/config/events.d/10.interface +++ b/ctdb/config/events.d/10.interface @@ -18,13 +18,13 @@ loadconfig mark_up () { - ok=1 + up_interfaces_found=true ctdb setifacelink $1 up >/dev/null 2>&1 } mark_down () { - fail=1 + fail=true ctdb setifacelink $1 down >/dev/null 2>&1 } @@ -43,8 +43,8 @@ monitor_interfaces() INTERFACES=`for IFACE in $INTERFACES $IFACES ; do echo $IFACE ; done | sort | uniq` - fail=0 - ok=0 + fail=false + up_interfaces_found=false for IFACE in $INTERFACES ; do ip addr show $IFACE 2>/dev/null >/dev/null || { @@ -109,15 +109,11 @@ monitor_interfaces() done - test x"$fail" = x"0" && { - return 0; - } + $fail || return 0 - test x"$ok" = x"1" && { - return 2; - } + $up_interfaces_found && return 2 - return 1; + return 1 } case "$1" in -- cgit