Fix the timeout arg for the su_rabbit_cmd

And fix local bashisms as a little bonus
Upstream patch https://github.com/rabbitmq/rabbitmq-server/pull/374

Related-bug: #1464637

Change-Id: I13189de9f8abce23673c031d11132e495e1972e3
Signed-off-by: Bogdan Dobrelya <bdobrelia@mirantis.com>
This commit is contained in:
Bogdan Dobrelya 2015-10-15 17:15:30 +02:00
parent 56f55f373a
commit 0204868a14
1 changed files with 5 additions and 4 deletions

View File

@ -286,7 +286,7 @@ END
su_rabbit_cmd() {
local timeout
if [ "$1" = "-t" ]; then
timeout=="/usr/bin/timeout ${OCF_RESKEY_command_timeout} $2"
timeout="/usr/bin/timeout ${OCF_RESKEY_command_timeout} $2"
shift 2
else
timeout=$COMMAND_TIMEOUT
@ -404,7 +404,8 @@ rmq_setup_env() {
# user
for dir in ${PID_DIR} "${OCF_RESKEY_mnesia_base}" "${OCF_RESKEY_log_dir}"; do
if test -e ${dir}; then
local files=$(su -s /bin/sh - $OCF_RESKEY_username -c "find ${dir} ! -writable")
local files
files=$(su -s /bin/sh - $OCF_RESKEY_username -c "find ${dir} ! -writable")
if [ "${files}" ]; then
ocf_log warn "Directory ${dir} is not writable by ${OCF_RESKEY_username}, chowning."
chown -R ${OCF_RESKEY_username}:${OCF_RESKEY_groupname} "${dir}"
@ -1135,8 +1136,8 @@ wait_sync() {
wait_time=$1
queues="${COMMAND_TIMEOUT} ${OCF_RESKEY_ctl} list_queues name state"
su_rabbit_cmd -t "${wait_time}s" "sh -c \"while $queues | grep -q 'syncing,'; \
do sleep 1; done\""
su_rabbit_cmd -t "${wait_time}" "sh -c \"while ${queues} | grep -q 'syncing,'; \
do sleep 2; done\""
return $?
}