Allow posture warnings before Borg
This commit is contained in:
@@ -8,6 +8,7 @@ FRESHNESS_CHECK="${FRESHNESS_CHECK:-$REPO_ROOT/ops/restore-tests/check-restore-f
|
||||
PRE_BACKUP_DUMPS="${PRE_BACKUP_DUMPS:-$SCRIPT_DIR/pre-backup-dumps.sh}"
|
||||
NTFY_SCRIPT="${NTFY_SCRIPT:-$REPO_ROOT/ops/restore-tests/send-ntfy.sh}"
|
||||
NTFY_TOPIC="${NTFY_TOPIC:-kallilab-critical}"
|
||||
ALLOW_POSTURE_WARNING="${ALLOW_POSTURE_WARNING:-1}"
|
||||
|
||||
notify_failure() {
|
||||
local step="$1"
|
||||
@@ -31,7 +32,18 @@ run_step() {
|
||||
fi
|
||||
}
|
||||
|
||||
run_step "posture-check" "$POSTURE_CHECK"
|
||||
echo "[pre-borg] Running posture-check"
|
||||
if "$POSTURE_CHECK"; then
|
||||
echo "[pre-borg] OK: posture-check"
|
||||
else
|
||||
rc=$?
|
||||
if [ "$rc" -eq 1 ] && [ "$ALLOW_POSTURE_WARNING" = "1" ]; then
|
||||
echo "[pre-borg] WARNING: posture-check returned warnings; continuing because ALLOW_POSTURE_WARNING=1"
|
||||
else
|
||||
notify_failure "posture-check" "Command failed with exit code $rc: $POSTURE_CHECK"
|
||||
exit "$rc"
|
||||
fi
|
||||
fi
|
||||
run_step "pre-backup-dumps" "$PRE_BACKUP_DUMPS"
|
||||
run_step "restore-freshness" "$FRESHNESS_CHECK"
|
||||
|
||||
|
||||
Reference in New Issue
Block a user