Merge "[COMMON] Fix condition equality bashisms"
[oom.git] / kubernetes / appc / resources / config / appc / opt / onap / appc / bin / startODL.sh
index 22d3836..2fd6db1 100755 (executable)
@@ -1,4 +1,5 @@
 #!/bin/bash -x
+{{/*
 
 ###
 # ============LICENSE_START=======================================================
@@ -27,8 +28,9 @@
 #  if not already installed, and starts the APPC Docker Container
 #
 #set -x
+*/}}
 
-function enable_odl_cluster(){
+enable_odl_cluster () {
   if [ -z $APPC_REPLICAS ]; then
      echo "APPC_REPLICAS is not configured in Env field"
      exit
@@ -54,7 +56,7 @@ ODL_HOME=${ODL_HOME:-/opt/opendaylight/current}
 SDNC_HOME=${SDNC_HOME:-/opt/onap/ccsdk}
 APPC_HOME=${APPC_HOME:-/opt/onap/appc}
 SLEEP_TIME=${SLEEP_TIME:-120}
-MYSQL_PASSWD=${MYSQL_PASSWD:-{{.Values.config.mariadbRootPassword}}}
+MYSQL_PASSWD=${MYSQL_ROOT_PASSWORD}
 ENABLE_ODL_CLUSTER=${ENABLE_ODL_CLUSTER:-false}
 ENABLE_AAF=${ENABLE_AAF:-true}
 DBINIT_DIR=${DBINIT_DIR:-/opt/opendaylight/current/daexim}
@@ -63,7 +65,7 @@ DBINIT_DIR=${DBINIT_DIR:-/opt/opendaylight/current/daexim}
 # Wait for database to init properly
 #
 echo "Waiting for mariadbgalera"
-until mysql -h {{.Values.config.mariadbGaleraSVCName}}.{{.Release.Namespace}} -u root -p{{.Values.config.mariadbRootPassword}} mysql &> /dev/null
+until mysql -h {{.Values.config.mariadbGaleraSVCName}}.{{.Release.Namespace}} -u root -p${MYSQL_PASSWD}  mysql &> /dev/null
 do
   printf "."
   sleep 1
@@ -77,20 +79,20 @@ fi
 
 if [ ! -f ${DBINIT_DIR}/.installed ]
 then
-        sdnc_db_exists=$(mysql -h {{.Values.config.mariadbGaleraSVCName}}.{{.Release.Namespace}} -u root -p{{.Values.config.mariadbRootPassword}} mysql <<-END
+        sdnc_db_exists=$(mysql -h {{.Values.config.mariadbGaleraSVCName}}.{{.Release.Namespace}} -u root -p${MYSQL_PASSWD} mysql <<-END
 show databases like 'sdnctl';
 END
 )
-        if [ "x${sdnc_db_exists}" == "x" ]
+        if [ "x${sdnc_db_exists}" = "x" ]
         then
             echo "Installing SDNC database"
             ${SDNC_HOME}/bin/installSdncDb.sh
 
-            appc_db_exists=$(mysql -h {{.Values.config.mariadbGaleraSVCName}}.{{.Release.Namespace}} -u root -p{{.Values.config.mariadbRootPassword}} mysql <<-END
+            appc_db_exists=$(mysql -h {{.Values.config.mariadbGaleraSVCName}}.{{.Release.Namespace}} -u root -p${MYSQL_PASSWD} mysql <<-END
 show databases like 'appcctl';
 END
 )
-            if [ "x${appc_db_exists}" == "x" ]
+            if [ "x${appc_db_exists}" = "x" ]
             then
               echo "Installing APPC database"
               ${APPC_HOME}/bin/installAppcDb.sh
@@ -139,8 +141,6 @@ then
         if $ENABLE_AAF
         then
              cp ${APPC_HOME}/data/properties/aaa-app-config.xml ${ODL_HOME}/etc/opendaylight/datastore/initial/config/aaa-app-config.xml
-        else
-             cp ${APPC_HOME}/data/aaa-app-config.xml ${ODL_HOME}/etc/opendaylight/datastore/initial/config/aaa-app-config.xml
         fi
 
 fi