1
0
mirror of https://github.com/samba-team/samba.git synced 2025-01-11 05:18:09 +03:00

ctdb-tests: Reformat node_has_status()

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>
This commit is contained in:
Martin Schwenke 2019-07-29 15:31:55 +10:00 committed by Martin Schwenke
parent c3f9698175
commit 52227d1973

View File

@ -324,20 +324,20 @@ node_has_status ()
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}\$" ;;
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
@ -351,10 +351,12 @@ node_has_status ()
{
read x
while read line ; do
# This needs to be done in 2 steps to avoid false matches.
# 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
[ "${line_bits#${bits}}" != "$line_bits" ] && \
return 0
done
return 1
} <<<"$out" # Yay bash!