restore: SLOWDISK gate matches Python-templated "True" (capitalized)

The SLOWDISK value is emitted by Python templates as capitalized booleans (True/False), so
match "True" (also accept manual lowercase "true"); anything else = offload off. --no-slowdisk
sets SLOWDISK=False to override.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This commit is contained in:
2026-06-15 04:58:13 +00:00
parent 6c110c08ed
commit 57b5757a85

View File

@@ -15,11 +15,11 @@ done
set -- "${_pos[@]}"
# Static-file offload gate. Hosts with a real dedicated extra disk mounted at /slowdisk set
# SLOWDISK=true in their .env; that (and only the literal "true") enables the offload. The
# --no-slowdisk flag disables it even when SLOWDISK=true (e.g. the extra disk is full).
# SLOWDISK=True in their .env (Python-templated boolean, capitalized); that enables the
# offload. The --no-slowdisk flag disables it even when SLOWDISK=True (e.g. extra disk full).
[ -f "$dir/.env" ] && source "$dir/.env"
SLOWDISK="${SLOWDISK:-}"
[ "$no_slowdisk_flag" = 1 ] && SLOWDISK=false
[ "$no_slowdisk_flag" = 1 ] && SLOWDISK=False
remote_source="$2"
if [[ -n "$remote_source" ]] && is_local_backup_url "$remote_source"; then
@@ -43,13 +43,16 @@ fi
# hot/dynamic state stays on the primary disk. tar then extracts THROUGH the symlinks via
# --keep-directory-symlink (it keeps the dir-symlinks instead of clobbering them).
# Target naming matches delete-volumes.sh / delete_slowdisk_targets_for_key cleanup.
# GATED on SLOWDISK (see top): offload runs only when SLOWDISK is exactly "true" (set in the
# host .env on dedicated-extra-disk hosts) and the --no-slowdisk flag was not passed. Case
# matters — only the literal lowercase "true" enables it. Safe fallbacks (normal extract):
# SLOWDISK not "true", /slowdisk missing, no manifest, or no static paths.
# GATED on SLOWDISK (see top): offload runs only when SLOWDISK is the Python-templated boolean
# "True" (set in the host .env on dedicated-extra-disk hosts) and the --no-slowdisk flag was
# not passed. Case matters — the value comes through as capitalized "True"/"False". Safe
# fallbacks (normal extract): SLOWDISK not True, /slowdisk missing, no manifest, no static paths.
prep_static_offload() {
local key=$1 meta=$2 data_dir=$3 rel target
[ "$SLOWDISK" = "true" ] || { echo " static offload disabled (SLOWDISK=$SLOWDISK) — normal extract"; return 0; }
case "$SLOWDISK" in
True|true) ;; # offload enabled (Python "True"; also accept manual lowercase "true")
*) echo " static offload disabled (SLOWDISK=$SLOWDISK) — normal extract"; return 0 ;;
esac
[ -d /slowdisk ] || { echo " /slowdisk absent — no static offload"; return 0; }
[ -f "$meta" ] || { echo " no manifest ($meta) — no static offload"; return 0; }
# manifest data lines (after the 3-line header) are "<size> <relpath>"