move http to https
[appc/deployment.git] / installation / appc / src / main / scripts / dockerInstall.sh
index 1196004..a35896d 100644 (file)
@@ -40,6 +40,15 @@ ${ODL_HOME}/bin/start
 echo "Waiting ${SLEEP_TIME} seconds for OpenDaylight to initialize"
 sleep ${SLEEP_TIME}
 
+echo "Checking that Karaf can be accessed"
+clientOutput=$(${ODL_HOME}/bin/client shell:echo KarafLoginCheckIsWorking)
+if echo "$clientOutput" | grep -q "KarafLoginCheckIsWorking"; then
+echo "Karaf login succeeded"
+else
+echo "Error during Karaf login"
+exit 1
+fi
+
 echo "Copying a working version of the logging configuration into the opendaylight etc folder"
 cp ${APPC_HOME}/data/org.ops4j.pax.logging.cfg ${ODL_HOME}/etc/org.ops4j.pax.logging.cfg
 echo "Copying a new version of aaf cadi shiro into the opendaylight deploy folder"
@@ -61,25 +70,16 @@ echo "" >> $APPC_HOME/data/properties/appc.properties
 echo "Copying the aaa shiro configuration into opendaylight"
 cp ${APPC_HOME}/data/aaa-app-config.xml ${ODL_HOME}/etc/opendaylight/datastore/initial/config/aaa-app-config.xml
 
-echo "Stopping OpenDaylight"
-${ODL_HOME}/bin/stop
-checkRun () {
-  running=0
-  while read a b c d e f g h
-  do
-    if [ "$h" == "/bin/sh /opt/opendaylight/bin/karaf server" ]
-    then
-      running=1
-    fi
-  done < <(ps -eaf)
-  echo $running
-}
+echo "Copying jetty, keystore for https into opendalight"
+cp ${APPC_HOME}/data/jetty.xml ${ODL_HOME}/etc/jetty.xml
+cp ${APPC_HOME}/data/keystore ${ODL_HOME}/etc/keystore
+cp ${APPC_HOME}/data/custom.properties ${ODL_HOME}/etc/custom.properties
 
-while [ $( checkRun ) == 1 ]
-do
-  echo "Karaf is still running, waiting..."
-  sleep 5s
-done
+echo "Stopping OpenDaylight and waiting for it to stop"
+${ODL_HOME}/bin/stop
+#The karaf command will exit when odl shuts down. This is the most reliable way to wait for opendaylight to stop
+#before exiting the docker container.
+${ODL_HOME}/bin/karaf
 echo "Karaf process has stopped"
 sleep 10s