Phase 25: Interrupted deployment reconciliation
This commit is contained in:
@@ -0,0 +1,22 @@
|
||||
"""Reconcile interrupted disposable deployments without guessing intent."""
|
||||
|
||||
from core.locking import DeploymentLock
|
||||
|
||||
|
||||
def reconcile(planner, rollback, services, *, confirmation=None, fingerprint=None):
|
||||
if (confirmation is None) != (fingerprint is None):
|
||||
raise ValueError("Both recovery confirmation and plan fingerprint are required")
|
||||
with DeploymentLock(planner.lock_path):
|
||||
plan = planner._inspect()
|
||||
if plan["status"] in {"CLEAR", "VERIFIED"}:
|
||||
if confirmation is not None:
|
||||
raise ValueError("There is no eligible interrupted activation")
|
||||
return plan
|
||||
if confirmation is None:
|
||||
services.quiesce()
|
||||
if not services.stopped():
|
||||
raise RuntimeError("Unable to contain interrupted deployment")
|
||||
return plan
|
||||
if rollback.planner is not planner:
|
||||
raise ValueError("Rollback uses different transaction state")
|
||||
return rollback._execute(confirmation, fingerprint)
|
||||
Reference in New Issue
Block a user