diff options
author | Martin Schwenke <martin@meltin.net> | 2011-06-28 16:10:23 +1000 |
---|---|---|
committer | Martin Schwenke <martin@meltin.net> | 2011-08-12 14:49:27 +1000 |
commit | 00c4cc6d2287edb10f82e47afbf1e97f24d78eb2 (patch) | |
tree | 906ef17d9a6c2e74b9daf1bfd2daf96360fbd34a | |
parent | bb5db84021bb459781c55ebca5fa463f328cdafd (diff) | |
download | samba-00c4cc6d2287edb10f82e47afbf1e97f24d78eb2.tar.gz samba-00c4cc6d2287edb10f82e47afbf1e97f24d78eb2.tar.xz samba-00c4cc6d2287edb10f82e47afbf1e97f24d78eb2.zip |
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 <martin@meltin.net>
(This used to be ctdb commit 3402930319d462eab5525410f6a676952e120182)
-rwxr-xr-x | ctdb/config/events.d/10.interface | 18 |
1 files 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 |