Fix stable Statbel release identity
This commit is contained in:
@@ -42,6 +42,12 @@ DEFAULT_EVIDENCE_ROOT = Path("/app/storage/operator-evidence/statbel-population-
|
||||
YEAR_PATTERN = re.compile(r"^20[0-9]{2}$")
|
||||
SHA256_PATTERN = re.compile(r"^[0-9a-f]{64}$")
|
||||
ACTIONABLE_STATUSES = {"update_available", "not_loaded"}
|
||||
STABLE_CATALOG_IDENTITY_FIELDS = (
|
||||
"metadata_identifier",
|
||||
"metadata_url",
|
||||
"remote_version",
|
||||
"capabilities_sha256",
|
||||
)
|
||||
|
||||
|
||||
def parse_args() -> argparse.Namespace:
|
||||
@@ -431,7 +437,13 @@ def load_staged_plan(
|
||||
|
||||
|
||||
def require_catalog_unchanged(plan: dict[str, Any], decision: dict[str, Any]) -> None:
|
||||
if plan.get("release") != decision.get("release") or plan.get("catalog_identity") != decision.get("catalog_identity"):
|
||||
planned_identity = plan.get("catalog_identity") or {}
|
||||
current_identity = decision.get("catalog_identity") or {}
|
||||
identity_changed = any(
|
||||
planned_identity.get(field) != current_identity.get(field)
|
||||
for field in STABLE_CATALOG_IDENTITY_FIELDS
|
||||
)
|
||||
if plan.get("release") != decision.get("release") or identity_changed:
|
||||
raise RuntimeError("The official Statbel release evidence changed; create and review a new staged plan")
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user