fix(reboot): follow scoped relink receipt safe next
Some checks failed
CD Pipeline / workflow-shape (push) Successful in 0s
CD Pipeline / cancel-stale-cd (push) Has been skipped
CD Pipeline / tests (push) Successful in 1m13s
CD Pipeline / build-and-deploy (push) Successful in 5m11s
CD Pipeline / post-deploy-checks (push) Has been cancelled

This commit is contained in:
ogt
2026-07-10 10:33:47 +08:00
parent d97b114abd
commit df70a0233f
2 changed files with 41 additions and 5 deletions

View File

@@ -127,6 +127,15 @@ _WINDOWS99_MISSING_VMX_NEXT_SAFE_ACTION = (
"restore_windows99_missing_vmx_source_for_aliases_then_rerun_no_secret_"
"collector_and_scorecard_no_vm_power_change"
)
_WINDOWS99_SCOPED_RELINK_RECEIPT_FILE = (
"windows99-vmx-source-scoped-relink-dry-run-receipt.snapshot.json"
)
_WINDOWS99_SCOPED_RELINK_RECEIPT_SCHEMA_VERSION = (
"windows99_vmx_source_scoped_relink_dry_run_receipt_v1"
)
_WINDOWS99_SCOPED_RELINK_READY_NEXT_SAFE_ACTION = (
"rerun_no_secret_collector_and_scorecard_no_vm_power_change"
)
_WINDOWS99_POWERED_OFF_NEXT_SAFE_ACTION = (
"run_windows99_vmware_autostart_check_mode_package_for_powered_off_aliases_"
"then_rerun_no_secret_collector_no_vm_power_change"
@@ -1386,6 +1395,8 @@ def _windows99_collected_runtime_next_safe_action(
):
return ""
if _strings(metric_readback.get("windows99_missing_vmx_aliases")):
if _windows99_scoped_relink_receipt_ready():
return _WINDOWS99_SCOPED_RELINK_READY_NEXT_SAFE_ACTION
return _WINDOWS99_MISSING_VMX_NEXT_SAFE_ACTION
if _strings(metric_readback.get("windows99_powered_off_aliases")):
return _WINDOWS99_POWERED_OFF_NEXT_SAFE_ACTION
@@ -1406,6 +1417,28 @@ def _read_json_file(path: Path) -> dict[str, Any]:
return payload if isinstance(payload, dict) else {}
def _windows99_scoped_relink_receipt_ready(
operations_dir: Path | None = None,
) -> bool:
receipt = _read_json_file(
(operations_dir or _DEFAULT_OPERATIONS_DIR)
/ _WINDOWS99_SCOPED_RELINK_RECEIPT_FILE
)
aliases = _strings(receipt.get("target_vm_aliases"))
return bool(
receipt.get("schema_version")
== _WINDOWS99_SCOPED_RELINK_RECEIPT_SCHEMA_VERSION
and receipt.get("target_host_alias") == "99"
and aliases == ["111"]
and receipt.get("ready") is True
and receipt.get("reviewer_validation_passed") is True
and receipt.get("controlled_relink_dry_run_ready") is True
and receipt.get("remote_write_performed") is not True
and receipt.get("vm_power_change_performed") is not True
and receipt.get("secret_value_read") is not True
)
def apply_public_maintenance_runtime_readback(
payload: dict[str, Any],
runtime_readback: dict[str, Any],