refactor: rename CURRENT_DIR_NAME to BACKUP_SUBPATH for clarity
This commit is contained in:
@@ -39,9 +39,9 @@ FAILED_ALREADY=0
|
||||
BACKUP_COMPLETE=0
|
||||
RSYNC_WARNINGS=()
|
||||
|
||||
# Stable mirror path — not timestamped so later runs update the same
|
||||
# destination and only transfer new or changed files.
|
||||
CURRENT_DIR_NAME="Sovran_SystemsOS_Backup/current"
|
||||
# Stable rsync mirror sub-path under the target drive. Not timestamped
|
||||
# so later runs update the same destination and only transfer new or changed files.
|
||||
BACKUP_SUBPATH="Sovran_SystemsOS_Backup/current"
|
||||
|
||||
# ── Logging helpers ──────────────────────────────────────────────
|
||||
|
||||
@@ -329,7 +329,7 @@ validate_target_mount "$TARGET"
|
||||
# ── Set up stable backup destination ────────────────────────────
|
||||
# Subsequent runs update the same mirror, transferring only new or changed files.
|
||||
|
||||
BACKUP_DIR="${TARGET}/${CURRENT_DIR_NAME}"
|
||||
BACKUP_DIR="${TARGET}/${BACKUP_SUBPATH}"
|
||||
mkdir -p "$BACKUP_DIR"
|
||||
|
||||
# Write an INCOMPLETE marker immediately; replaced by BACKUP_COMPLETE only
|
||||
|
||||
@@ -76,6 +76,8 @@ class ManualBackupWorkflowTests(unittest.TestCase):
|
||||
source = BACKUP_SCRIPT.read_text()
|
||||
self.assertIn("Sovran_SystemsOS_Backup/current", source,
|
||||
"backup must use a stable 'current' mirror path")
|
||||
self.assertIn("BACKUP_SUBPATH", source,
|
||||
"stable sub-path must be defined in BACKUP_SUBPATH variable")
|
||||
# Must not create new timestamped directories per run
|
||||
self.assertNotIn(
|
||||
"date '+%Y%m%d_%H%M%S'",
|
||||
@@ -566,8 +568,8 @@ echo "SHOULD_NOT_REACH_HERE"
|
||||
script = f"""#!/usr/bin/env bash
|
||||
set -euo pipefail
|
||||
TARGET="{target}"
|
||||
CURRENT_DIR_NAME="Sovran_SystemsOS_Backup/current"
|
||||
BACKUP_DIR="${{TARGET}}/${{CURRENT_DIR_NAME}}"
|
||||
BACKUP_SUBPATH="Sovran_SystemsOS_Backup/current"
|
||||
BACKUP_DIR="${{TARGET}}/${{BACKUP_SUBPATH}}"
|
||||
mkdir -p "$BACKUP_DIR"
|
||||
echo "$BACKUP_DIR"
|
||||
"""
|
||||
|
||||
Reference in New Issue
Block a user