Accept validated PostgreSQL self-restart demotion
This commit is contained in:
@@ -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 \
|
||||
|
||||
Reference in New Issue
Block a user