mirror of
https://github.com/kevinveenbirkenbach/computer-playbook.git
synced 2026-11-06 10:59:59 +00:00
Add DIR_BACKUPS to utils.paths and INFINITO_DIR_BACKUPS / INFINITO_DIR_SECRETS env handlers, derive the recover-console constants (including NFS_EXPORT_STATE) from utils.paths and the nfs export SPOT, and switch every remaining self-built /var/lib/infinito subpath - the secrets recover targets, the swarm extras backup source, the users token-store candidate chain, the CI recover drill, the swarm NFS diagnostics and the playwright reports dir - to those constants. Tests consume the env constants directly; narration comments in the touched files are dropped per the comment lint. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
28 lines
998 B
Python
28 lines
998 B
Python
"""Standard filesystem layout the recover console restores into.
|
|
|
|
Derived from the paths SPOT (utils.paths, backed by
|
|
group_vars/all/05_paths.yml). This uniform layout is what lets a recovery
|
|
target a host by name alone: every host restores into these same paths.
|
|
"""
|
|
|
|
from __future__ import annotations
|
|
|
|
from pathlib import Path
|
|
|
|
from utils.paths import DIR_BACKUPS as _DIR_BACKUPS
|
|
from utils.paths import DIR_SECRETS as _DIR_SECRETS
|
|
from utils.paths import DIR_VAR_LIB as _DIR_VAR_LIB
|
|
from utils.storage.nfs import STATE_SUBDIR, get_export_base, state_path
|
|
|
|
DIR_VAR_LIB = str(_DIR_VAR_LIB)
|
|
BACKUP_ROOT = str(_DIR_BACKUPS)
|
|
SECRETS_DIR = str(_DIR_SECRETS)
|
|
NFS_EXPORT_STATE = state_path(get_export_base(), STATE_SUBDIR)
|
|
RECOVER_MOUNT = "/mnt/infinito-recover"
|
|
|
|
|
|
def volume_from_source(source: str) -> str:
|
|
"""Docker volume name embedded in a snapshot path ``<generation>/<volume>/files``."""
|
|
path = Path(source.rstrip("/"))
|
|
return path.parent.name if path.name == "files" else path.name
|