mirror of
https://github.com/samba-team/samba.git
synced 2024-12-23 17:34:34 +03:00
ctdb-tests: Handle special cases first and return
All the other cases involve matching bits. 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:
parent
bb59073515
commit
bff1a3a548
@ -322,6 +322,19 @@ node_has_status ()
|
||||
local pnn="$1"
|
||||
local status="$2"
|
||||
|
||||
case "$status" in
|
||||
recovered)
|
||||
! $CTDB status -n "$pnn" | \
|
||||
grep -Eq '^Recovery mode:RECOVERY \(1\)$'
|
||||
return
|
||||
;;
|
||||
notlmaster)
|
||||
! $CTDB status -n "$pnn" | \
|
||||
grep -Eq "^hash:.* lmaster:${pnn}\$"
|
||||
return
|
||||
;;
|
||||
esac
|
||||
|
||||
local bits
|
||||
case "$status" in
|
||||
unhealthy) bits="?|?|?|1|*" ;;
|
||||
@ -334,22 +347,10 @@ node_has_status ()
|
||||
enabled) bits="?|?|0|*" ;;
|
||||
stopped) bits="?|?|?|?|1|*" ;;
|
||||
notstopped) bits="?|?|?|?|0|*" ;;
|
||||
recovered)
|
||||
! $CTDB status -n "$pnn" | \
|
||||
grep -Eq '^Recovery mode:RECOVERY \(1\)$'
|
||||
return
|
||||
;;
|
||||
notlmaster)
|
||||
! $CTDB status -n "$pnn" | \
|
||||
grep -Eq "^hash:.* lmaster:${pnn}\$"
|
||||
return
|
||||
;;
|
||||
*)
|
||||
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
|
||||
@ -366,10 +367,6 @@ node_has_status ()
|
||||
done
|
||||
return 1
|
||||
} <<<"$out" # Yay bash!
|
||||
else
|
||||
echo 'node_has_status: unknown mode, $bits not set'
|
||||
return 1
|
||||
fi
|
||||
}
|
||||
|
||||
wait_until_node_has_status ()
|
||||
|
Loading…
Reference in New Issue
Block a user