tripleo-upgrade/templates/check_service_haproxy_backend.sh.j2
Jose Luis Franco Arza 46372986ae Change docker references to podman.
There are still some post upgrade validations which use docker
instead of podman. Changing them to the right containers engine.

Change-Id: I3560f67c59004652e38aaa006287460e283c9d07
2019-09-19 11:42:43 +02:00

28 lines
1.2 KiB
Django/Jinja

source {{ undercloud_rc }}
NODE_IP=$(openstack server show {{ node_name | splitext | first }} -f json | jq -r .addresses | grep -oP '[0-9.]+')
## in case of external loadbalancer haproxy resource is not running on controller nodes
EXT_LB=$(ssh -q -o StrictHostKeyChecking=no heat-admin@$NODE_IP 'sudo hiera -c /etc/puppet/hiera.yaml enable_load_balancer')
if [[ $EXT_LB != 'false' ]]; then
timeout_seconds={{ node_reboot_timeout }}
elapsed_seconds=0
while true; do
rm -rf ~/haproxy.stats
echo "Waiting for haproxy backend services to come up"
ssh -q -o StrictHostKeyChecking=no heat-admin@$NODE_IP > ~/haproxy.stats <<-\SSH
sudo podman exec $(sudo podman ps | grep -oP haproxy-bundle.*) bash -c 'echo "show stat" | socat /var/lib/haproxy/stats stdio | grep -v redis'
SSH
grep DOWN ~/haproxy.stats > /dev/null
if [[ $? != 0 ]]; then
echo "HAproxy backends are ready"
break
fi
sleep 3
(( elapsed_seconds += 3 ))
if [ $elapsed_seconds -ge $timeout_seconds ]; then
echo "FAILURE: $(grep DOWN haproxy.stats | awk -F ',' {'print $1'}) is down on $(grep DOWN haproxy.stats | awk -F ',' {'print $2'})"
exit 1
fi
done
fi