From 39cf2fc84846a59e02b51313b01153a276e2c08c Mon Sep 17 00:00:00 2001 From: Taka Cho Date: Fri, 15 May 2020 09:24:28 -0400 Subject: [PATCH] fix script for install APPC features 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 --- .../appc/src/main/scripts/dockerInstall.sh | 40 +++++++++++++--------- 1 file changed, 24 insertions(+), 16 deletions(-) diff --git a/installation/appc/src/main/scripts/dockerInstall.sh b/installation/appc/src/main/scripts/dockerInstall.sh index e25d21a..8ae86ca 100644 --- a/installation/appc/src/main/scripts/dockerInstall.sh +++ b/installation/appc/src/main/scripts/dockerInstall.sh @@ -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. @@ -25,29 +25,37 @@ # 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) -- 2.16.6