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