X-Git-Url: https://gerrit.onap.org/r/gitweb?a=blobdiff_plain;f=dbc-client%2Fmisc%2Fdbc-client;h=c29ec86eb51f00eb853b2d3b199b82ac50423cfd;hb=85e7c7e57c262e38a0b3e0a14e4ebf4b92f00a58;hp=a7317fa812de97528007ce016dee54927ee0966d;hpb=bd10cc4a582b3d1a2f162aab5a2494953618af93;p=dmaap%2Fbuscontroller.git diff --git a/dbc-client/misc/dbc-client b/dbc-client/misc/dbc-client index a7317fa..c29ec86 100644 --- a/dbc-client/misc/dbc-client +++ b/dbc-client/misc/dbc-client @@ -25,7 +25,6 @@ umask 0022 TZ=GMT0 COMPONENT=dbc-client APP_ROOT=${APP_ROOT:-/opt/app/$COMPONENT} -USER=root export TZ PATH=/usr/local/bin:/bin:/usr/bin:/usr/local/sbin:/usr/sbin:/sbin export PATH @@ -35,6 +34,12 @@ REQUESTID=${REQUESTID:-dbc-client} DBC=${DBC:-dmaap-bc} PROTO=${PROTO:-https} PORT=${PORT:-8443} +WAIT_TO_EXIT=${WAIT_TO_EXIT:-N} +PEMDIR=${PEMDIR:-/opt/app/osaaf/local} +CAPEM=${CAPEM:-ca.pem} +CLIENTPEM=${CLIENTPEM:-client.pem} +KEYPEM=${KEYPEM:-key.pem} +CERTPWD=${CERTPWD:-'2U[iOZzMHI:.#tdCwlBqc;}S'} @@ -47,6 +52,18 @@ config() { echo "Expected app root directory $APP_ROOT does not exist" exit 1 fi + cd $PEMDIR + pwd + ls -l + if [ -f $CAPEM -a -f $CLIENTPEM -a -f $KEYPEM ] + then + echo "--key $PEMDIR/$KEYPEM --cacert $PEMDIR/$CAPEM --cert $PEMDIR/${CLIENTPEM}:${CERTPWD}" > $PEMDIR/curl.cred + CURLCRED="-K $PEMDIR/curl.cred" + else + echo "Warning: PEM files for authorization not found!" + CURLCRED="" + fi + echo "CURLCRED=$CURLCRED" cd $APP_ROOT find . -type f -exec ls -l {} \; find $CONFIGMAP_ROOT -type f -exec ls -l {} \; @@ -57,7 +74,7 @@ config() { source $CONTAINER_CONFIG fi - if [ "$DMAAPBC_WAIT_TO_EXIT" != "Y" ] + if [ "$WAIT_TO_EXIT" != "Y" ] then echo "Creating $APP_ROOT/ok_to_exit so no waiting..." > $APP_ROOT/ok_to_exit @@ -70,6 +87,7 @@ config() { init() { + set -x echo "ENTER init" if [ ! -d $CONFIGMAP_ROOT ] then @@ -82,18 +100,20 @@ init() { 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" ${PROTO}://${DBC}:${PORT}/webapi/dmaap` + rc=`curl $CURLCRED -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 + set +x } dopost() { + set -x RETRY_TIME=60 loop=true - while [ $loop ] + while [ $loop = true ] 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}` + rc=`curl $CURLCRED -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" @@ -105,10 +125,12 @@ dopost() { ;; esac done + set +x } doprov() { + set -x cd $CONFIGMAP_ROOT pwd # order is important in this next list @@ -123,6 +145,7 @@ doprov() { done fi done + set +x } delay() { echo "DELAY=$DELAY" @@ -132,7 +155,6 @@ delay() { fi } -set -x delay config init