summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMartin Schwenke <martin@meltin.net>2011-06-28 16:27:01 +1000
committerMartin Schwenke <martin@meltin.net>2011-08-12 15:00:03 +1000
commit6fa27bdf1888458379ea7e39073c5eb1da7e5102 (patch)
tree1c3472a59c1fbad954d3a54a4d8bc830bef55e03
parent00c4cc6d2287edb10f82e47afbf1e97f24d78eb2 (diff)
downloadsamba-6fa27bdf1888458379ea7e39073c5eb1da7e5102.tar.gz
samba-6fa27bdf1888458379ea7e39073c5eb1da7e5102.tar.xz
samba-6fa27bdf1888458379ea7e39073c5eb1da7e5102.zip
Eventscripts: 10.interfaces clean-ups - push logic into monitor_interfaces().
The logic in the monitor event itself is very complex. Nearly all of it can go away by adding a single check of $CTDB_PARTIALLY_ONLINE_INTERFACES to the return logic of monitor_interfaces() and reversing the sense of the corresponding check. Signed-off-by: Martin Schwenke <martin@meltin.net> (This used to be ctdb commit fa93177442c65c2a4eb2d5d5dba0a0da1c486969)
-rwxr-xr-xctdb/config/events.d/10.interface20
1 files changed, 4 insertions, 16 deletions
diff --git a/ctdb/config/events.d/10.interface b/ctdb/config/events.d/10.interface
index 207a9d38ca..f998a6492b 100755
--- a/ctdb/config/events.d/10.interface
+++ b/ctdb/config/events.d/10.interface
@@ -111,7 +111,9 @@ monitor_interfaces()
$fail || return 0
- $up_interfaces_found && return 2
+ $up_interfaces_found && \
+ [ "$CTDB_PARTIALLY_ONLINE_INTERFACES" = "yes" ] && \
+ return 0
return 1
}
@@ -270,21 +272,7 @@ case "$1" in
;;
monitor)
- monitor_interfaces
- ret=$?
-
- test x"$ret" = x"2" && {
- test x"$CTDB_PARTIALLY_ONLINE_INTERFACES" != x"yes" && {
- exit 1;
- }
- # as long as we have one interface available don't become
- # unhealthy
- ret=0
- }
-
- test x"$ret" != x"0" && {
- exit 1;
- }
+ monitor_interfaces || exit 1
;;
*)
ctdb_standard_event_handler "$@"