ctdb-scripts: Clarify logic for success of interface monitoring
authorMartin Schwenke <martin@meltin.net>
Wed, 16 Dec 2015 08:18:49 +0000 (19:18 +1100)
committerMichael Adam <obnox@samba.org>
Tue, 12 Jan 2016 18:16:18 +0000 (19:16 +0100)
The current code uses so many shell idioms that it is difficult to
follow.

Signed-off-by: Martin Schwenke <martin@meltin.net>
Reviewed-by: Michael Adam <obnox@samba.org>
ctdb/config/events.d/10.interface

index 7445200b3287014db9034b9a64f7ad94344324c7..0cd11123f1dff889a061499e2177ce650dffb832 100755 (executable)
@@ -152,13 +152,16 @@ monitor_interfaces()
 
        done
 
-       $fail || return 0
-
-       $up_interfaces_found && \
-           [ "$CTDB_PARTIALLY_ONLINE_INTERFACES" = "yes" ] && \
+       if $fail ; then
+           if $up_interfaces_found && \
+                   [ "$CTDB_PARTIALLY_ONLINE_INTERFACES" = "yes" ] ; then
+               return 0
+           else
+               return 1
+           fi
+       else
            return 0
-
-       return 1
+       fi
 }
 
 # Sets: iface, ip, maskbits, family