3 # ============LICENSE_START==========================================
5 # ===================================================================
6 # Copyright © 2019 AT&T Intellectual Property. All rights reserved.
7 # ===================================================================
8 # Licensed under the Apache License, Version 2.0 (the "License");
9 # you may not use this file except in compliance with the License.
10 # You may obtain a copy of the License at
12 # http://www.apache.org/licenses/LICENSE-2.0
14 # Unless required by applicable law or agreed to in writing, software
15 # distributed under the License is distributed on an "AS IS" BASIS,
16 # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
17 # See the License for the specific language governing permissions and
18 # limitations under the License.
19 # ============LICENSE_END============================================
20 # ECOMP is a trademark and service mark of AT&T Intellectual Property.
27 APP_ROOT=${APP_ROOT:-/opt/app/$COMPONENT}
30 PATH=/usr/local/bin:/bin:/usr/bin:/usr/local/sbin:/usr/sbin:/sbin
32 CONFIGMAP_ROOT=${CONFIGMAP_ROOT:-/opt/app/config}
33 CONTAINER_CONFIG=$CONFIGMAP_ROOT/conf/dbc-client.env
34 REQUESTID=${REQUESTID:-dbc-client}
38 WAIT_TO_EXIT=${WAIT_TO_EXIT:-N}
39 PEMDIR=${PEMDIR:-/opt/app/osaaf/local}
40 CAPEM=${CAPEM:-ca.pem}
41 CLIENTPEM=${CLIENTPEM:-client.pem}
42 KEYPEM=${KEYPEM:-key.pem}
43 CERTPWD=${CERTPWD:-'2U[iOZzMHI:.#tdCwlBqc;}S'}
53 echo "Expected app root directory $APP_ROOT does not exist"
59 if [ -f $CAPEM -a -f $CLIENTPEM -a -f $KEYPEM ]
61 echo "--key $PEMDIR/$KEYPEM --cacert $PEMDIR/$CAPEM --cert $PEMDIR/${CLIENTPEM}:${CERTPWD}" > $PEMDIR/curl.cred
62 CURLCRED="-K $PEMDIR/curl.cred"
64 echo "Warning: PEM files for authorization not found!"
67 echo "CURLCRED=$CURLCRED"
69 find . -type f -exec ls -l {} \;
70 find $CONFIGMAP_ROOT -type f -exec ls -l {} \;
71 if [ ! -f $CONTAINER_CONFIG ]
73 echo "WARNING: Expected env file $CONTAINER_CONFIG not found. Default behaviors in effect"
75 source $CONTAINER_CONFIG
78 if [ "$WAIT_TO_EXIT" != "Y" ]
80 echo "Creating $APP_ROOT/ok_to_exit so no waiting..."
81 > $APP_ROOT/ok_to_exit
83 echo "Not creating $APP_ROOT/ok_to_exit"
93 if [ ! -d $CONFIGMAP_ROOT ]
95 echo $CONFIGMAP_ROOT does not exist
99 #loop on get /dmaap until we get a good response to indicate other provisioning can continue
101 while [ $rc != "200" ]
104 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`
105 echo "get dmaap response=${rc}"
115 while [ $loop = true ]
117 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`
124 echo "`date`: http response=$rc. Will retry after $RETRY_TIME seconds"
137 # order is important in this next list
138 for uri in dmaap dcaeLocations mr_clusters topics mr_clients dr_nodes feeds dr_pubs dr_subs
142 for j in `ls ${uri}/*.json`
144 echo "POST $j to $uri"
164 echo "Check $APP_ROOT/ok_to_exit"
165 while [ ! -f $APP_ROOT/ok_to_exit ]
167 echo "$APP_ROOT/ok_to_exit does not exist. Sticking around for debugging..."