diff options
author | Lusheng Ji <lji@research.att.com> | 2018-04-15 08:21:02 -0400 |
---|---|---|
committer | Lusheng Ji <lji@research.att.com> | 2018-04-15 08:21:11 -0400 |
commit | 15cfc5e7400c90efffd34af2c2e7bf453b0e6fa5 (patch) | |
tree | fa9ba11c5e7732d405c087bf364fc8f0daed7458 | |
parent | 5648b85924ed92b556c30322ae28a1c169a1db1e (diff) |
Add wait for consul/CBS info
Issue-ID: DCAEGEN2-257
Change-Id: I9c62e59f2f0b34afcbf101ddc72b3bcec63caaf2
Signed-off-by: Lusheng Ji <lji@research.att.com>
-rwxr-xr-x | tca-cdap-container/restart.sh | 13 |
1 files changed, 10 insertions, 3 deletions
diff --git a/tca-cdap-container/restart.sh b/tca-cdap-container/restart.sh index 32c920e..fdb9dbe 100755 --- a/tca-cdap-container/restart.sh +++ b/tca-cdap-container/restart.sh @@ -43,9 +43,16 @@ CONFIG_BINDING_SERVICE=${CONFIG_BINDING_SERVICE:-config_binding_service} CBS_SERVICE_NAME=${CONFIG_BINDING_SERVICE} -CBS_HOST=$(curl -s "${CONSUL_HOST}:${CONSUL_PORT}/v1/catalog/service/${CBS_SERVICE_NAME}" |jq .[0].ServiceAddress |sed -e 's/\"//g') -CBS_PORT=$(curl -s "${CONSUL_HOST}:${CONSUL_PORT}/v1/catalog/service/${CBS_SERVICE_NAME}" |jq .[0].ServicePort |sed -e 's/\"//g') -CBS_HOST=${CBS_HOST:-config_binding_service} +unset CBS_HOST +unset CBS_PORT +until [ ! -z "$CBS_HOST" ]; do + echo "Retrieving host and port for ${CBS_SERVICE_NAME} from ${CONSUL_HOST}:${CONSUL_PORT}" + sleep 2 + CBS_HOST=$(curl -s "${CONSUL_HOST}:${CONSUL_PORT}/v1/catalog/service/${CBS_SERVICE_NAME}" |jq .[0].ServiceAddress |sed -e 's/\"//g') + CBS_PORT=$(curl -s "${CONSUL_HOST}:${CONSUL_PORT}/v1/catalog/service/${CBS_SERVICE_NAME}" |jq .[0].ServicePort |sed -e 's/\"//g') +done +echo "Retrieved host and port for ${CBS_SERVICE_NAME} as ${CBS_HOST}:${CBS_PORT}" +CBS_HOST=${CBS_HOST:-config-binding-service} CBS_PORT=${CBS_PORT:-10000} #Changing to HOSTNAME parameter for consistency with k8s deploy |