[PATCHES] Various CTDB bug fixes and improvements

Michael Adam obnox at samba.org
Tue Jan 12 19:26:59 UTC 2016


On 2016-01-12 at 19:17 +0100, Michael Adam wrote:
> On 2016-01-12 at 16:55 +1100, Martin Schwenke wrote:
> > 
> > From 2e59c95c9a63ab38e22045ef9a0970fa2b10e1b8 Mon Sep 17 00:00:00 2001
> > From: Martin Schwenke <martin at meltin.net>
> > Date: Wed, 16 Dec 2015 19:18:49 +1100
> > Subject: [PATCH 06/10] ctdb-scripts: Clarify logic for success of interface
> >  monitoring
> > 
> > The current code uses so many shell idioms that it is difficult to
> > follow.
> > 
> > Signed-off-by: Martin Schwenke <martin at meltin.net>
> 
> - attached find a follow-up patch that further
>   (imho) simplifies it by reducing indentation.

attached? ... but now :-)

Michael
-------------- next part --------------
From a4bbfa06fc266db790bd74e219ef385b7f881bfb Mon Sep 17 00:00:00 2001
From: Michael Adam <obnox at samba.org>
Date: Tue, 12 Jan 2016 18:59:15 +0100
Subject: [PATCH] ctdb-scripts: further untangle logic for success of interface
 monitoring

Reduces intentation by using early returns.

Signed-off-by: Michael Adam <obnox at samba.org>
---
 ctdb/config/events.d/10.interface | 17 ++++++++++-------
 1 file changed, 10 insertions(+), 7 deletions(-)

diff --git a/ctdb/config/events.d/10.interface b/ctdb/config/events.d/10.interface
index 4b9f31c..00b5f97 100755
--- a/ctdb/config/events.d/10.interface
+++ b/ctdb/config/events.d/10.interface
@@ -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
-- 
2.5.0

-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 198 bytes
Desc: not available
URL: <http://lists.samba.org/pipermail/samba-technical/attachments/20160112/992dfb28/signature.sig>


More information about the samba-technical mailing list