refactor: rename CURRENT_DIR_NAME to BACKUP_SUBPATH for clarity

This commit is contained in:
copilot-swe-agent[bot]
2026-07-20 22:47:53 +00:00
committed by GitHub
parent 0fa804a430
commit e16eaabdde
2 changed files with 8 additions and 6 deletions
@@ -39,9 +39,9 @@ FAILED_ALREADY=0
BACKUP_COMPLETE=0 BACKUP_COMPLETE=0
RSYNC_WARNINGS=() RSYNC_WARNINGS=()
# Stable mirror path — not timestamped so later runs update the same # Stable rsync mirror sub-path under the target drive. Not timestamped
# destination and only transfer new or changed files. # so later runs update the same destination and only transfer new or changed files.
CURRENT_DIR_NAME="Sovran_SystemsOS_Backup/current" BACKUP_SUBPATH="Sovran_SystemsOS_Backup/current"
# ── Logging helpers ────────────────────────────────────────────── # ── Logging helpers ──────────────────────────────────────────────
@@ -329,7 +329,7 @@ validate_target_mount "$TARGET"
# ── Set up stable backup destination ──────────────────────────── # ── Set up stable backup destination ────────────────────────────
# Subsequent runs update the same mirror, transferring only new or changed files. # 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" mkdir -p "$BACKUP_DIR"
# Write an INCOMPLETE marker immediately; replaced by BACKUP_COMPLETE only # Write an INCOMPLETE marker immediately; replaced by BACKUP_COMPLETE only
+4 -2
View File
@@ -76,6 +76,8 @@ class ManualBackupWorkflowTests(unittest.TestCase):
source = BACKUP_SCRIPT.read_text() source = BACKUP_SCRIPT.read_text()
self.assertIn("Sovran_SystemsOS_Backup/current", source, self.assertIn("Sovran_SystemsOS_Backup/current", source,
"backup must use a stable 'current' mirror path") "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 # Must not create new timestamped directories per run
self.assertNotIn( self.assertNotIn(
"date '+%Y%m%d_%H%M%S'", "date '+%Y%m%d_%H%M%S'",
@@ -566,8 +568,8 @@ echo "SHOULD_NOT_REACH_HERE"
script = f"""#!/usr/bin/env bash script = f"""#!/usr/bin/env bash
set -euo pipefail set -euo pipefail
TARGET="{target}" TARGET="{target}"
CURRENT_DIR_NAME="Sovran_SystemsOS_Backup/current" BACKUP_SUBPATH="Sovran_SystemsOS_Backup/current"
BACKUP_DIR="${{TARGET}}/${{CURRENT_DIR_NAME}}" BACKUP_DIR="${{TARGET}}/${{BACKUP_SUBPATH}}"
mkdir -p "$BACKUP_DIR" mkdir -p "$BACKUP_DIR"
echo "$BACKUP_DIR" echo "$BACKUP_DIR"
""" """