tripleo-upgrade/templates/check_service_rabbitmq.sh.j2
Yurii Prokulevych 1d03dfbd80 Address ansible-lint issues
Co-Authored-By: Sergii Golovatiuk <sgolovat@redhat.com>

Change-Id: I9367af823058ef5f4edd5e671cdbb971f0451422
2018-12-20 14:55:38 +01:00

23 lines
1.0 KiB
Django/Jinja

source {{ undercloud_rc }}
OC_USER="{{ (overcloud_ssh_user) | ternary(overcloud_ssh_user, 'heat-admin') }}"
NODE_IP=$(openstack server show {{ node_name | splitext | first }} -f json | jq -r .addresses | grep -oP '[0-9.]+')
## wait for rabbitmq resource to come back up
timeout_seconds={{ node_reboot_timeout }}
elapsed_seconds=0
while true; do
echo "Waiting for rabbitmq pcs resource to start"
RABBIT_RES=$(ssh -q -o StrictHostKeyChecking=no $OC_USER@$NODE_IP 'sudo pcs status --full' | grep ocf::heartbeat:rabbitmq-cluster | grep -vi FAILED | grep -i started | wc -l)
if [[ $RABBIT_RES = 1 ]] || [[ $RABBIT_RES > 2 ]]; then
echo "${RABBIT_RES} instances of rabbitmq pcs resource are started"
break
fi
sleep 3
(( elapsed_seconds += 3 ))
if [ $elapsed_seconds -ge $timeout_seconds ]; then
echo "FAILURE: Rabbitmq pcs resource didn't get started after reboot"
ssh -q -o StrictHostKeyChecking=no $OC_USER@$NODE_IP 'sudo pcs status --full' | grep 'ocf::heartbeat:rabbitmq-cluster'
exit 1
fi
done