ctdb-tests: Clean up startup event in 00.test event script
authorMartin Schwenke <martin@meltin.net>
Mon, 11 Jun 2018 20:48:37 +0000 (06:48 +1000)
committerMartin Schwenke <martins@samba.org>
Mon, 2 Jul 2018 06:51:22 +0000 (08:51 +0200)
Rewrite interface initialisation to avoid an error when there are no
interfaces configured.  Re-indent case label.

Signed-off-by: Martin Schwenke <martin@meltin.net>
Reviewed-by: Amitay Isaacs <amitay@gmail.com>
ctdb/tests/simple/etc-ctdb/events/legacy/00.test.script

index 78856666bf07fbbe2ab1b2f4fdb2a5ab15cb084e..03f44ff2c8c5b8784003dabfbd6c1ab266e52060 100755 (executable)
@@ -9,11 +9,10 @@ event="$1"
 shift
 
 case "$event" in
-     startup)
-       IFACES=`ctdb ifaces -X | grep -v '^|Name|LinkStatus|References|'`
-       for I in $IFACES; do
-               IFACE=`echo -n "$I" | cut -d '|' -f2`
-               ctdb setifacelink $IFACE up
+startup)
+       ifaces=$(ctdb ifaces -X | tail -n +2 | cut -d '|' -f2)
+       for i in $ifaces; do
+               ctdb setifacelink "$i" up
        done
        ;;
 esac