From 9bd1b0a5f3e421823aaf7ef243ebe9c5d30b7855 Mon Sep 17 00:00:00 2001 From: Vincent Untz Date: Fri, 31 Mar 2017 13:23:00 +0200 Subject: [PATCH] OCF RA: Don't hardcode primitive name in rabbitmq-server-ha.ocf We can compute the name of the primitive automatically from environment variables, instead of hard-coding p_rabbitmq-server; this makes the resource agent more flexible. Closes https://github.com/rabbitmq/rabbitmq-server-release/issues/23 --- scripts/rabbitmq-server-ha.ocf | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/scripts/rabbitmq-server-ha.ocf b/scripts/rabbitmq-server-ha.ocf index 49f3af7..81fe19b 100755 --- a/scripts/rabbitmq-server-ha.ocf +++ b/scripts/rabbitmq-server-ha.ocf @@ -89,6 +89,7 @@ OCF_RESKEY_command_timeout_default="" : ${OCF_RESKEY_command_timeout=${OCF_RESKEY_command_timeout_default}} TIMEOUT_ARG=$((OCF_RESKEY_CRM_meta_timeout / 6000 + 30)) COMMAND_TIMEOUT="/usr/bin/timeout ${OCF_RESKEY_command_timeout} ${TIMEOUT_ARG}" +RESOURCE_NAME=`echo $OCF_RESOURCE_INSTANCE | cut -d ":" -f 1` ####################################################################### @@ -654,7 +655,7 @@ get_node_start_time() { } get_node_master_score() { - get_integer_node_attr $1 'master-p_rabbitmq-server' + get_integer_node_attr $1 "master-${RESOURCE_NAME}" } # Return either rabbit node name as FQDN or shortname, depends on the OCF_RESKEY_use_fqdn.