]> git.ipfire.org Git - thirdparty/samba.git/commitdiff
ctdb-tests: Reformat node_has_status()
authorMartin Schwenke <martin@meltin.net>
Mon, 29 Jul 2019 05:31:55 +0000 (15:31 +1000)
committerKarolin Seeger <kseeger@samba.org>
Tue, 3 Sep 2019 12:05:37 +0000 (12:05 +0000)
Re-indent and drop non-POSIX left-parenthesis from case labels.

BUG: https://bugzilla.samba.org/show_bug.cgi?id=14085

Signed-off-by: Martin Schwenke <martin@meltin.net>
Reviewed-by: Amitay Isaacs <amitay@gmail.com>
(cherry picked from commit 52227d19735a3305ad633672c70385f443f222f0)

ctdb/tests/scripts/integration.bash

index e0aa312192b5e9ba492554a7b89f3873e032b006..0a40044324003101b341a6f7dbbe3157483d7344 100644 (file)
@@ -315,53 +315,55 @@ wait_until_ready ()
 # This function is becoming nicely overloaded.  Soon it will collapse!  :-)
 node_has_status ()
 {
-    local pnn="$1"
-    local status="$2"
-
-    local bits fpat mpat rpat
-    case "$status" in
-       (unhealthy)    bits="?|?|?|1|*" ;;
-       (healthy)      bits="?|?|?|0|*" ;;
-       (disconnected) bits="1|*" ;;
-       (connected)    bits="0|*" ;;
-       (banned)       bits="?|1|*" ;;
-       (unbanned)     bits="?|0|*" ;;
-       (disabled)     bits="?|?|1|*" ;;
-       (enabled)      bits="?|?|0|*" ;;
-       (stopped)      bits="?|?|?|?|1|*" ;;
-       (notstopped)   bits="?|?|?|?|0|*" ;;
-       (frozen)       fpat='^[[:space:]]+frozen[[:space:]]+1$' ;;
-       (unfrozen)     fpat='^[[:space:]]+frozen[[:space:]]+0$' ;;
-       (recovered)    rpat='^Recovery mode:RECOVERY \(1\)$' ;;
-       (notlmaster)   rpat="^hash:.* lmaster:${pnn}\$" ;;
+       local pnn="$1"
+       local status="$2"
+
+       local bits fpat mpat rpat
+       case "$status" in
+       unhealthy)    bits="?|?|?|1|*" ;;
+       healthy)      bits="?|?|?|0|*" ;;
+       disconnected) bits="1|*" ;;
+       connected)    bits="0|*" ;;
+       banned)       bits="?|1|*" ;;
+       unbanned)     bits="?|0|*" ;;
+       disabled)     bits="?|?|1|*" ;;
+       enabled)      bits="?|?|0|*" ;;
+       stopped)      bits="?|?|?|?|1|*" ;;
+       notstopped)   bits="?|?|?|?|0|*" ;;
+       frozen)       fpat='^[[:space:]]+frozen[[:space:]]+1$' ;;
+       unfrozen)     fpat='^[[:space:]]+frozen[[:space:]]+0$' ;;
+       recovered)    rpat='^Recovery mode:RECOVERY \(1\)$' ;;
+       notlmaster)   rpat="^hash:.* lmaster:${pnn}\$" ;;
        *)
-           echo "node_has_status: unknown status \"$status\""
-           return 1
-    esac
-
-    if [ -n "$bits" ] ; then
-       local out x line
-
-       out=$($CTDB -X status 2>&1) || return 1
-
-       {
-            read x
-            while read line ; do
-               # This needs to be done in 2 steps to avoid false matches.
-               local line_bits="${line#|${pnn}|*|}"
-               [ "$line_bits" = "$line" ] && continue
-               [ "${line_bits#${bits}}" != "$line_bits" ] && return 0
-            done
-           return 1
-       } <<<"$out" # Yay bash!
-    elif [ -n "$fpat" ] ; then
-       $CTDB statistics -n "$pnn" | egrep -q "$fpat"
-    elif [ -n "$rpat" ] ; then
-        ! $CTDB status -n "$pnn" | egrep -q "$rpat"
-    else
-       echo 'node_has_status: unknown mode, neither $bits nor $fpat is set'
-       return 1
-    fi
+               echo "node_has_status: unknown status \"$status\""
+               return 1
+       esac
+
+       if [ -n "$bits" ] ; then
+               local out x line
+
+               out=$($CTDB -X status 2>&1) || return 1
+
+               {
+                       read x
+                       while read line ; do
+                               # This needs to be done in 2 steps to
+                               # avoid false matches.
+                               local line_bits="${line#|${pnn}|*|}"
+                               [ "$line_bits" = "$line" ] && continue
+                               [ "${line_bits#${bits}}" != "$line_bits" ] && \
+                                       return 0
+                       done
+                       return 1
+               } <<<"$out" # Yay bash!
+       elif [ -n "$fpat" ] ; then
+               $CTDB statistics -n "$pnn" | egrep -q "$fpat"
+       elif [ -n "$rpat" ] ; then
+               ! $CTDB status -n "$pnn" | egrep -q "$rpat"
+       else
+               echo 'node_has_status: unknown mode, neither $bits nor $fpat is set'
+               return 1
+       fi
 }
 
 wait_until_node_has_status ()