fix script for install APPC features 71/107571/1
authorTaka Cho <takamune.cho@att.com>
Fri, 15 May 2020 13:24:28 +0000 (09:24 -0400)
committerTakamune Cho <takamune.cho@att.com>
Fri, 15 May 2020 18:52:32 +0000 (18:52 +0000)
sleep 120 sec was the logic, but it cannot
make sure karaf is ready within 120 seconds
use echo karaf command to make sure karaf is ready
instead

Issue-ID: APPC-1877
Change-Id: Ib1e17e5909890ed2342c313e94939bec392d86c5
Signed-off-by: Taka Cho <takamune.cho@att.com>
installation/appc/src/main/scripts/dockerInstall.sh

index e25d21a..8ae86ca 100644 (file)
@@ -9,9 +9,9 @@
 # Licensed under the Apache License, Version 2.0 (the "License");
 # you may not use this file except in compliance with the License.
 # You may obtain a copy of the License at
-# 
+#
 #      http://www.apache.org/licenses/LICENSE-2.0
-# 
+#
 # Unless required by applicable law or agreed to in writing, software
 # distributed under the License is distributed on an "AS IS" BASIS,
 # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 # It starts opendaylight, installs the appc features, then shuts down opendaylight.
 #
 ODL_HOME=${ODL_HOME:-/opt/opendaylight}
-ODL_ADMIN_PASSWORD=${ODL_ADMIN_PASSWORD:-Kp8bJ4SXszM0WXlhak3eHlcse2gAw84vaoGGmJvUy2U}
 SDNC_HOME=${SDNC_HOME:-/opt/onap/ccsdk}
 APPC_HOME=${APPC_HOME:-/opt/onap/appc}
-SLEEP_TIME=${SLEEP_TIME:-120}
-MYSQL_PASSWD=${MYSQL_PASSWD:-openECOMP1.0}
 
 appcInstallStartTime=$(date +%s)
 
-
-echo "Waiting ${SLEEP_TIME} seconds for OpenDaylight to initialize"
-sleep ${SLEEP_TIME}
-
+TIME_OUT=1000
+INTERVAL=30
+TIME=0
 echo "Checking that Karaf can be accessed"
+while [ "$TIME" -lt "$TIME_OUT" ]; do
+
 ##clientOutput=$(${ODL_HOME}/bin/client shell:echo KarafLoginCheckIsWorking)
-clientOutput=$(sshpass -pkaraf ssh -o StrictHostKeyChecking=no karaf@localhost -p 8101 "shell:echo KarafLoginCheckIsWorking")
-if echo "$clientOutput" | grep -q "KarafLoginCheckIsWorking"; then
-echo "Karaf login succeeded"
-else
-echo "Error during Karaf login"
-exit 1
+  clientOutput=$(sshpass -pkaraf ssh -o StrictHostKeyChecking=no karaf@localhost -p 8101 "shell:echo KarafLoginCheckIsWorking")
+  if echo "$clientOutput" | grep -q "KarafLoginCheckIsWorking"; then
+    echo "Karaf login succeeded"
+    echo localhost ready in $TIME seconds
+    break;
+  else
+     echo Sleep: $INTERVAL seconds before localhost address is ready. Total wait time up now is: $TIME seconds. Timeout is: $TIME_OUT seconds
+  fi
+
+  sleep $INTERVAL
+  TIME=$(($TIME+$INTERVAL))
+done
+
+if [ "$TIME" -ge "$TIME_OUT" ]; then
+  echo "Error during Karaf login, abort manual run dockerInstall.sh to instaill APPC platform features"
+  exit 1
 fi
 
-echo "Installing APPC platform features"
+echo "Karaf login is ready, installing APPC platform features"
 ${APPC_HOME}/bin/installFeatures.sh
 
 appcInstallEndTime=$(date +%s)