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
This commit is contained in:
Vincent Untz 2017-03-31 13:23:00 +02:00 committed by Michael Klishin
parent 49f4c4b566
commit 564a54a168
No known key found for this signature in database
GPG Key ID: D1A1B77724CE35D5
1 changed files with 2 additions and 1 deletions

View File

@ -85,6 +85,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`
#######################################################################
@ -623,7 +624,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.