Accept validated PostgreSQL self-restart demotion

This commit is contained in:
Lyncoln
2026-09-18 09:43:41 -04:00
parent 798aa40ae5
commit 3937de82dc
4 changed files with 139 additions and 8 deletions
@@ -71,12 +71,23 @@ import os
response = json.loads(os.environ["MC_DAEMON_RESPONSE"])
if (
response.get("ocf_rc") != 0
or response.get("ready") is not True
or response.get("mutation") is not False
or response.get("final_handoff_required") is not True
):
common_valid = (
response.get("ocf_rc") == 0
and response.get("ready") is True
and response.get("mutation") is False
)
peer_handoff = (
response.get("final_handoff_required") is True
)
local_restart = (
response.get("final_handoff_required") is False
and response.get("handoff_mode") == "local_restart"
and response.get("reason") == "local_restart_demotion_ready"
)
if not common_valid or not (peer_handoff or local_restart):
raise SystemExit(1)
'; then
ocf_log info \