blob: d795ddde679fea12d24724a6e56830749d9ef8b3 [file] [log] [blame]
Michael Lando451a3402017-02-19 10:28:42 +02001#!/bin/sh
2
3export CHEFNAME=${ENVNAME}
4# executing chef-solo for configuration
5cd /root/chef-solo
6echo "normal['HOST_IP'] = \"${HOST_IP}\"" > /root/chef-solo/cookbooks/sdc-catalog-be/attributes/default.rb
7chef-solo -c solo.rb -E ${CHEFNAME}
8
9sed -i '/^set -e/aJAVA_OPTIONS=\" -XX:MaxPermSize=256m -Xmx1500m -Dconfig.home=${JETTY_BASE}\/config -Dlog.home=${JETTY_BASE}\/logs -Dlogback.configurationFile=${JETTY_BASE}\/config\/catalog-be\/logback.xml -Dconfiguration.yaml=${JETTY_BASE}\/config\/catalog-be\/configuration.yaml\"' /docker-entrypoint.sh
10sed -i '/^set -e/aTMPDIR=${JETTY_BASE}\/temp' /docker-entrypoint.sh
11
12# executiong the jetty
13cd /var/lib/jetty
14/docker-entrypoint.sh &
15
16# add the consumers
17cd /root/chef-solo
18python /root/chef-solo/cookbooks/sdc-catalog-be/files/default/consumers.py &
19
20# add the user
21python /root/chef-solo/cookbooks/sdc-catalog-be/files/default/user.py &
22
23# check if BackEnd is up
24python /root/chef-solo/cookbooks/sdc-normatives/files/default/check_Backend_Health.py
25
26# executing the normatives
27cd /root/chef-solo
28check_normative="/tmp/check_normative.out"
29curl -s -X GET -H "Content-Type: application/json;charset=UTF-8" -H "USER_ID: jh0003" -H "X-ECOMP-RequestID: cbe744a0-037b-458f-aab5-df6e543c4090" -H "Cache-Control: no-cache" -H "Postman-Token: af08ca1c-302f-1431-404f-ed84246e07c9" "http://${HOST_IP}:8080/sdc2/rest/v1/screen" > ${check_normative}
30
31echo "normal['HOST_IP'] = \"${HOST_IP}\"" > /root/chef-solo/cookbooks/sdc-normatives/attributes/default.rb
32resources_len=`cat ${check_normative}| jq '.["resources"]|length'`
33if [ $resources_len -eq 0 ] ; then
34 chef-solo -c normatives.rb
35else
36 sed -i "s/import/upgrade/g" normatives.json
37 chef-solo -c normatives.rb
38fi
39
40while true; do sleep 2; done