Report notification successor from target action
This commit is contained in:
@@ -494,9 +494,23 @@ def notify_target(config, runtime_state, request_parameters):
|
||||
operation = notification.get("operation")
|
||||
|
||||
if operation == "demote":
|
||||
target_node = notification.get("demote_uname", "").strip().lower()
|
||||
target_node = notification.get(
|
||||
"demote_uname",
|
||||
"",
|
||||
).strip().lower()
|
||||
successor_node = notification.get(
|
||||
"promote_uname",
|
||||
"",
|
||||
).strip().lower()
|
||||
elif operation == "promote":
|
||||
target_node = notification.get("promote_uname", "").strip().lower()
|
||||
target_node = notification.get(
|
||||
"promote_uname",
|
||||
"",
|
||||
).strip().lower()
|
||||
successor_node = notification.get(
|
||||
"demote_uname",
|
||||
"",
|
||||
).strip().lower()
|
||||
else:
|
||||
return {
|
||||
"ocf_rc": 1,
|
||||
@@ -511,6 +525,7 @@ def notify_target(config, runtime_state, request_parameters):
|
||||
"target": target_node == node_name,
|
||||
"operation": operation,
|
||||
"target_node": target_node,
|
||||
"successor_node": successor_node,
|
||||
"node": node_name,
|
||||
"age_seconds": age,
|
||||
}
|
||||
|
||||
@@ -50,6 +50,14 @@ runtime_state = {
|
||||
result = plugin.notify_target(config, runtime_state, {})
|
||||
require(result["ocf_rc"] == 0, "fresh target query failed")
|
||||
require(result["target"] is True, "local demote target was not detected")
|
||||
require(
|
||||
result["target_node"] == "david-macbookpro",
|
||||
"local target node was incorrect",
|
||||
)
|
||||
require(
|
||||
result["successor_node"] == "david-prodesk",
|
||||
"successor node was not reported",
|
||||
)
|
||||
print("matching_target accepted")
|
||||
|
||||
config["PACEMAKER_NODE_NAME"] = "david-eve"
|
||||
|
||||
Reference in New Issue
Block a user