next_key_event_threshold=$((next_key_event_threshold+i))
+check_numkeys() {
+ _numkeys=$(get_keyids "$1" "$2" | wc -l)
+ test "$_numkeys" -eq "$NUM_KEYS" || return 1
+ return 0
+}
+
# Check keys for a configured zone. This verifies:
# 1. The right number of keys exist in the key pool ($1).
# 2. The right number of keys is active. Checks KEY1, KEY2, KEY3, and KEY4.
#
# It is expected that KEY1, KEY2, KEY3, and KEY4 arrays are set correctly.
# Found key identifiers are stored in the right key array.
-check_keys()
-{
+check_keys() {
n=$((n+1))
echo_i "check keys are created for zone ${ZONE} ($n)"
ret=0
echo_i "check number of keys for zone ${ZONE} in dir ${DIR} ($n)"
- _numkeys=$(get_keyids "$DIR" "$ZONE" | wc -l)
- test "$_numkeys" -eq "$NUM_KEYS" || log_error "bad number ($_numkeys) of key files for zone $ZONE (expected $NUM_KEYS)"
- test "$ret" -eq 0 || echo_i "failed"
- status=$((status+ret))
+ retry_quiet 10 check_numkeys "$DIR" "$ZONE" "$NUM_KEYS" || ret=1
+ if [ $ret -ne 0 ]; then
+ _numkeys=$(get_keyids "$1" "$2" | wc -l)
+ log_error "bad number of key files ($_numkeys) for zone $ZONE (expected $NUM_KEYS)"
+ status=$((status+ret))
+ fi
# Temporarily don't log errors because we are searching multiple files.
_log=0