Files
computer-playbook/cli/administration/deploy/development/deploy/drill.py
T
kevinveenbirkenbachandClaude Opus 4.8 16aa00d905 refactor(deploy-cli): split deploy.py into a per-responsibility package
One module per concern, mirroring the inventory/ subpackage layout:
run.py (single deploy pass + env forwarding SPOT), drill.py (recover
drill, host mode exempt, paths from CONTAINER_REPO_ROOT instead of a
hardcoded /opt/src/infinito), purge.py (inter-round cleanup) and
cli.py (arg parsing + round/pass loop, PASS 1/2 deduplicated).

Also extend the comment linter to flag bare string-expression
statements outside docstring position in Python: a triple-quoted
literal floating in a body is a comment in disguise and now runs
through the same validity rules; docstrings and PEP 224 attribute
docstrings stay allowed. Test narration comments moved into method
docstrings accordingly, and the design docs now link deploy/cli.py.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
2026-07-16 05:20:54 +02:00

31 lines
1.2 KiB
Python

"""Recover drill between the sync and async pass of the first round."""
from __future__ import annotations
import os
from cli.administration.deploy.development.mirrors import CONTAINER_REPO_ROOT
def _maybe_recover_drill(compose, plan_index: int) -> None:
"""Verify recovery between PASS 1 and PASS 2 of the first round: seed a
backup tree and `recover full` it back on this single host. Gated by
INFINITO_RECOVER_DRILL (off by default); raises on drill failure so the
deploy fails fast before the async pass. Host mode is exempt: the drill
verifies container backup trees, which host roles do not produce."""
if plan_index != 0:
return
if (os.environ.get("INFINITO_RECOVER_DRILL") or "").strip().lower() != "true":
return
if (os.environ.get("INFINITO_DEPLOY_MODE") or "").strip().lower() == "host":
return
print("=== recover drill (backup/recover verification between passes) ===")
drill_script = (
CONTAINER_REPO_ROOT / "scripts" / "tests" / "deploy" / "ci" / "recover_drill.sh"
)
compose.exec(
["bash", str(drill_script)],
extra_env={"INFINITO_REPO_ROOT": str(CONTAINER_REPO_ROOT)},
live=True,
)