footprint_writes.py python
21 lines 723 B
Raw
sha256:106ef9e12cca7f3be3ffb2a6bd3abfa76f032dce453c9e5010d732a8d86f2e14 Reconcile reviewed credential compatibility 32254cd939885d9… Human patch 8 days ago
1 """Footprint file writes with regime-specific modes (§K7.3.1 executable script)."""
2
3 from __future__ import annotations
4
5 import os
6 from pathlib import Path
7
8 from cli.atomic import WriteFailure, atomic_write_bytes
9 from cli.footprint import EXECUTABLE_FOOTPRINT_DESTINATIONS
10
11 FOOTPRINT_EXECUTABLE_MODE = 0o755
12
13
14 def write_footprint_bytes(path: Path, data: bytes, *, destination: str) -> None:
15 """Atomically write one footprint file; set mode ``0755`` for executable destinations."""
16 atomic_write_bytes(path, data)
17 if destination in EXECUTABLE_FOOTPRINT_DESTINATIONS:
18 try:
19 path.chmod(FOOTPRINT_EXECUTABLE_MODE)
20 except OSError as exc:
21 raise WriteFailure(path, exc) from exc
File History 2 commits
sha256:106ef9e12cca7f3be3ffb2a6bd3abfa76f032dce453c9e5010d732a8d86f2e14 Reconcile reviewed credential compatibility 32254cd939885d9… Human patch 8 days ago
sha256:c87cf2c2f03da507f66f93922cb339a2cbebb33ad6372a6039032fb09a20da12 Reconcile reviewed Overseer recovery d47291d5d9030de5ebef71… Human minor ⚠ 8 days ago