fix: close Walloon terrain provisioning
GeoIntel release gates / Compile, test, contracts and builds (push) Canceled after 0s
GeoIntel release gates / Python and npm vulnerability policy (push) Canceled after 0s
GeoIntel release gates / GIS image, SBOM and container scan (push) Canceled after 0s

This commit is contained in:
Codex
2026-07-22 08:02:58 +02:00
parent 6808f3a12e
commit cc1b905ed3
7 changed files with 113 additions and 22 deletions
+20 -3
View File
@@ -32,6 +32,17 @@ def sha256_file(path: Path) -> str:
return digest.hexdigest()
def write_text_atomic(path: Path, content: str, *, encoding: str) -> None:
temporary = path.with_suffix(path.suffix + ".part")
temporary.unlink(missing_ok=True)
try:
temporary.write_text(content, encoding=encoding)
temporary.replace(path)
except Exception:
temporary.unlink(missing_ok=True)
raise
def download(destination: Path) -> str:
temporary = destination.with_suffix(destination.suffix + ".part")
temporary.unlink(missing_ok=True)
@@ -202,8 +213,10 @@ def provision(destination: Path, force: bool, keep_archive: bool) -> dict:
archive.unlink(missing_ok=True)
validation = validate_raster(target)
source_digest = sha256_file(target)
target.with_suffix(".sha256").write_text(
f"{source_digest} {target.name}\n", encoding="ascii"
write_text_atomic(
target.with_suffix(".sha256"),
f"{source_digest} {target.name}\n",
encoding="ascii",
)
validation.update(
{
@@ -214,7 +227,11 @@ def provision(destination: Path, force: bool, keep_archive: bool) -> dict:
}
)
report_path = destination / "provisioning-report.json"
report_path.write_text(json.dumps(validation, indent=2) + "\n", encoding="utf-8")
write_text_atomic(
report_path,
json.dumps(validation, indent=2) + "\n",
encoding="utf-8",
)
print(f"SPW MNT: ready ({target.stat().st_size / 1024 / 1024 / 1024:.1f} GiB)")
print(f"Provisioning report: {report_path}")
return validation