ctdb-scripts: further untangle logic for success of interface monitoring
authorMichael Adam <obnox@samba.org>
Tue, 12 Jan 2016 17:59:15 +0000 (18:59 +0100)
committerMartin Schwenke <martins@samba.org>
Thu, 14 Jan 2016 21:41:29 +0000 (22:41 +0100)
Reduces intentation by using early returns.

Signed-off-by: Michael Adam <obnox@samba.org>
Reviewed-by: Martin Schwenke <martin@meltin.net>
Autobuild-User(master): Martin Schwenke <martins@samba.org>
Autobuild-Date(master): Thu Jan 14 22:41:29 CET 2016 on sn-devel-144

ctdb/config/events.d/10.interface

index 4b9f31c5a2b5d0b23b829b3fd8482c3c1cc1b11d..00b5f97d3e61aa441d2eba7e2b2f02e3bc336af7 100755 (executable)
@@ -152,16 +152,19 @@ monitor_interfaces()
 
        done
 
-       if $fail ; then
-           if $up_interfaces_found && \
-                   [ "$CTDB_PARTIALLY_ONLINE_INTERFACES" = "yes" ] ; then
+       if ! $fail ; then
                return 0
-           else
+       fi
+
+       if ! $up_interfaces_found ; then
+               return 1
+       fi
+
+       if [ "$CTDB_PARTIALLY_ONLINE_INTERFACES" != "yes" ]; then
                return 1
-           fi
-       else
-           return 0
        fi
+
+       return 0
 }
 
 # Sets: iface, ip, maskbits, family