Code Review
/
dmaap
/
buscontroller.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
review
|
tree
raw
|
inline
| side by side
Silent post to get respnse code
[dmaap/buscontroller.git]
/
dbc-client
/
misc
/
dbc-client
diff --git
a/dbc-client/misc/dbc-client
b/dbc-client/misc/dbc-client
index
a812460
..
8df970c
100644
(file)
--- a/
dbc-client/misc/dbc-client
+++ b/
dbc-client/misc/dbc-client
@@
-24,7
+24,7
@@
umask 0022
TZ=GMT0
COMPONENT=dbc-client
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
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}
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:-https}
+PORT=${PORT:-8443}
@@
-62,13
+65,6
@@
config() {
echo "Not creating $APP_ROOT/ok_to_exit"
fi
echo "Not creating $APP_ROOT/ok_to_exit"
fi
- if [ ! -f $APP_ROOT/misc/cert-client-init.sh ]
- then
- echo "Did not find $APP_ROOT/misc/cert-client-init.sh to append to truststore"
- exit 1
- fi
- $APP_ROOT/misc/cert-client-init.sh
-
set +x
}
set +x
}
@@
-82,14
+78,35
@@
init() {
fi
#loop on get /dmaap until we get a good response to indicate other provisioning can continue
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
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
}
echo "get dmaap response=${rc}"
done
}
+dopost() {
+ RETRY_TIME=60
+
+ loop=true
+
+ while [ $loop = true ]
+ do
+ rc=`curl -s -X POST -w "%{http_code}" -H "X-ECOMP-RequestID: $REQUESTID" -H "Content-Type: application/json" -d @${1} ${PROTO}://${DBC}:${PORT}/webapi/${2} -o /dev/null`
+ 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
doprov() {
cd $CONFIGMAP_ROOT
@@
-102,8
+119,7
@@
doprov() {
for j in `ls ${uri}/*.json`
do
echo "POST $j to $uri"
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
done
fi
done