CONTAINER_CONFIG=$CONFIGMAP_ROOT/conf/dbc-client.env
REQUESTID=${REQUESTID:-dbc-client}
DBC=${DBC:-dmaap-bc}
-PROTO=${PROTO:-http}
-PORT=${PORT:-8080}
+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"}
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 {} \;
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
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
}
init() {
+ set -x
echo "ENTER init"
if [ ! -d $CONFIGMAP_ROOT ]
then
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"
;;
esac
done
+ set +x
}
doprov() {
+ set -x
cd $CONFIGMAP_ROOT
pwd
# order is important in this next list
done
fi
done
+ set +x
}
delay() {
echo "DELAY=$DELAY"
fi
}
-set -x
delay
config
init