diff options
author | dglFromAtt <dgl@research.att.com> | 2019-03-14 20:30:20 +0000 |
---|---|---|
committer | dglFromAtt <dgl@research.att.com> | 2019-03-14 20:32:59 +0000 |
commit | 8d21e71c13ab39ec01070fedaa298ff72e62da58 (patch) | |
tree | f8968fb243939d6165ea3562d21f1de0b26573fa /dbc-client | |
parent | aa3cc0e7cd53265e8c82b56caf2f409ed5612e80 (diff) |
Added k8s-style retry to dmaap prov
Change-Id: I96fa44824c49a98dc621afe86f4796eaef0c596e
Signed-off-by: dglFromAtt <dgl@research.att.com>
Issue-ID: DMAAP-1087
Signed-off-by: dglFromAtt <dgl@research.att.com>
Diffstat (limited to 'dbc-client')
-rw-r--r-- | dbc-client/misc/dbc-client | 33 | ||||
-rw-r--r-- | dbc-client/pom.xml | 2 | ||||
-rw-r--r-- | dbc-client/version.properties | 2 |
3 files changed, 30 insertions, 7 deletions
diff --git a/dbc-client/misc/dbc-client b/dbc-client/misc/dbc-client index a812460..cf6c230 100644 --- a/dbc-client/misc/dbc-client +++ b/dbc-client/misc/dbc-client @@ -24,7 +24,7 @@ umask 0022 TZ=GMT0 COMPONENT=dbc-client -APP_ROOT=/opt/app/$COMPONENT +APP_ROOT=${APP_ROOT:-/opt/app/$COMPONENT} USER=root export TZ PATH=/usr/local/bin:/bin:/usr/bin:/usr/local/sbin:/usr/sbin:/sbin @@ -32,6 +32,9 @@ export PATH CONFIGMAP_ROOT=${CONFIGMAP_ROOT:-/opt/app/config} CONTAINER_CONFIG=$CONFIGMAP_ROOT/conf/dbc-client.env REQUESTID=${REQUESTID:-dbc-client} +DBC=${DBC:-dmaap-bc} +PROTO=${PROTO:-http} +PORT=${PORT:-8080} @@ -82,14 +85,35 @@ init() { fi #loop on get /dmaap until we get a good response to indicate other provisioning can continue - rc=999 + rc=${RESP:-999} while [ $rc != "200" ] do sleep 10 - rc=`curl -s -o /dev/null -I -w "%{http_code}" -X GET -H "X-ECOMP-RequestID: $REQUESTID" -H "Content-Type: application/json" http://dmaap-bc:8080/webapi/dmaap` + rc=`curl -s -o /dev/null -I -w "%{http_code}" -X GET -H "X-ECOMP-RequestID: $REQUESTID" -H "Content-Type: application/json" ${PROTO}://${DBC}:${PORT}/webapi/dmaap` echo "get dmaap response=${rc}" done } +dopost() { + RETRY_TIME=60 + + loop=true + + while [ $loop ] + do + rc=`curl -v -X POST -w "%{http_code}" -H "X-ECOMP-RequestID: $REQUESTID" -H "Content-Type: application/json" -d @${1} ${PROTO}://${DBC}:${PORT}/webapi/${2}` + case $rc in + 200 | 201 | 409 ) + echo "response=$rc" + loop=false + ;; + * ) + echo "`date`: http response=$rc. Will retry after $RETRY_TIME seconds" + sleep $RETRY_TIME + ;; + esac + done + +} doprov() { cd $CONFIGMAP_ROOT @@ -102,8 +126,7 @@ doprov() { for j in `ls ${uri}/*.json` do echo "POST $j to $uri" - rc=`curl -v -X POST -w "%{http_code}" -H "X-ECOMP-RequestID: $REQUESTID" -H "Content-Type: application/json" -d @${j} http://dmaap-bc:8080/webapi/${uri}` - echo "response=$rc" + dopost $j $uri done fi done diff --git a/dbc-client/pom.xml b/dbc-client/pom.xml index 7d36523..80defc5 100644 --- a/dbc-client/pom.xml +++ b/dbc-client/pom.xml @@ -249,7 +249,7 @@ <jettyVersion>9.4.12.RC2</jettyVersion> <eelf.version>1.0.0</eelf.version> <swagger.version>1.5.19</swagger.version> - <artifact.version>1.0.3</artifact.version> + <artifact.version>1.0.4</artifact.version> <!-- SONAR --> <jacoco.version>0.7.7.201606060606</jacoco.version> <sonar-jacoco-listeners.version>3.2</sonar-jacoco-listeners.version> diff --git a/dbc-client/version.properties b/dbc-client/version.properties index 870d861..faa90d4 100644 --- a/dbc-client/version.properties +++ b/dbc-client/version.properties @@ -27,7 +27,7 @@ major=1 minor=0 -patch=3 +patch=4 base_version=${major}.${minor}.${patch} # Release must be completed with git revision # in Jenkins |