#! /bin/bash
# Copyright (C) Metaswitch Networks 2015
# If license terms are provided to you in a COPYING file in the root directory
# of the source code repository by which you are accessing this code, then
# the license outlined in that COPYING file applies to your use.
# Otherwise no rights are granted except for those provided to you by
# Metaswitch Networks in a separate written agreement.

# Wait for the etcd process to come online
count=0
/usr/share/clearwater/bin/poll_etcd.sh --quorum

while [ $? -ne 0 ]; do
  ((count++))
  if [ $count -gt 300 ]; then
    echo "Etcd isn't responsive"
    exit 1
  fi

  sleep 1
  /usr/share/clearwater/bin/poll_etcd.sh --quorum
done
