Merge "[COMMON] Fix condition equality bashisms"
authorKrzysztof Opasiak <k.opasiak@samsung.com>
Tue, 27 Apr 2021 20:25:19 +0000 (20:25 +0000)
committerGerrit Code Review <gerrit@onap.org>
Tue, 27 Apr 2021 20:25:19 +0000 (20:25 +0000)
17 files changed:
kubernetes/appc/resources/config/appc/opt/onap/appc/bin/health_check.sh
kubernetes/appc/resources/config/appc/opt/onap/appc/bin/startODL.sh
kubernetes/common/cassandra/resources/restore.sh
kubernetes/common/cert-wrapper/resources/import-custom-certs.sh
kubernetes/common/music/resources/config/startup.sh
kubernetes/contrib/dns-server-for-vhost-ingress-testing/deploy_dns.sh
kubernetes/contrib/metallb-loadbalancer-inst/install-metallb-on-cluster.sh
kubernetes/contrib/tools/check-for-staging-images.sh
kubernetes/contrib/tools/rke/rke_setup.sh
kubernetes/helm/plugins/deploy/deploy.sh
kubernetes/robot/demo-k8s.sh
kubernetes/robot/ete-k8s.sh
kubernetes/robot/eteHelm-k8s.sh
kubernetes/sdnc/components/sdnc-prom/resources/bin/ensureSdncActive.sh
kubernetes/sdnc/components/sdnc-prom/resources/bin/ensureSdncStandby.sh
kubernetes/sdnc/components/sdnc-prom/resources/bin/prom.sh
kubernetes/sdnc/components/sdnc-prom/resources/bin/switchVoting.sh

index 6e35ca8..f2675b0 100755 (executable)
@@ -18,7 +18,7 @@
 waiting_bundles=$(/opt/opendaylight/current/bin/client bundle:list | grep Waiting | wc -l)
 run_level=$(/opt/opendaylight/current/bin/client system:start-level)
 
-  if [ "$run_level" == "Level 100" ] && [ "$waiting_bundles" -lt "1" ]
+  if [ "$run_level" = "Level 100" ] && [ "$waiting_bundles" -lt "1" ]
   then
     echo APPC is healthy.
   else
index c78daee..2fd6db1 100755 (executable)
@@ -83,7 +83,7 @@ then
 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
@@ -92,7 +92,7 @@ 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
index b56c0fa..a810534 100644 (file)
@@ -75,7 +75,7 @@ esac
 done
 
 # Validate inputs
-if [ "$base_db_dir" == "" ] || [ "$ss_dir" == "" ] || [ "$keyspace_name" == "" ]
+if [ "$base_db_dir" = "" ] || [ "$ss_dir" = "" ] || [ "$keyspace_name" = "" ]
 then
        echo ""
        echo ">>>>>>>>>>Not all inputs provided, please check usage >>>>>>>>>>"
index 87e584c..d955ecd 100755 (executable)
@@ -28,18 +28,18 @@ mkdir -p $WORK_DIR
 for f in $CERTS_DIR/*; do
   export canonical_name_nob64=$(echo $f | sed 's/.*\/\([^\/]*\)/\1/')
   export canonical_name_b64=$(echo $f | sed 's/.*\/\([^\/]*\)\(\.b64\)/\1/')
-  if [ "$AAF_ENABLED" == "false" ] && [ "$canonical_name_b64" == "$ONAP_TRUSTSTORE" ]; then
+  if [ "$AAF_ENABLED" = "false" ] && [ "$canonical_name_b64" = "$ONAP_TRUSTSTORE" ]; then
     # Dont use onap truststore when aaf is disabled
     continue
   fi
-  if [ "$AAF_ENABLED" == "false" ] && [ "$canonical_name_nob64" == "$ONAP_TRUSTSTORE" ]; then
+  if [ "$AAF_ENABLED" = "false" ] && [ "$canonical_name_nob64" = "$ONAP_TRUSTSTORE" ]; then
     # Dont use onap truststore when aaf is disabled
     continue
   fi
-  if [ ${f: -3} == ".sh" ]; then
+  if [ ${f: -3} = ".sh" ]; then
     continue
   fi
-  if [ ${f: -4} == ".b64" ]
+  if [ ${f: -4} = ".b64" ]
     then
       base64 -d $f > $WORK_DIR/`basename $f .b64`
     else
@@ -48,7 +48,7 @@ for f in $CERTS_DIR/*; do
 done
 
 # Prepare truststore output file
-if [ "$AAF_ENABLED" == "true" ]
+if [ "$AAF_ENABLED" = "true" ]
   then
     mv $WORK_DIR/$ONAP_TRUSTSTORE $WORK_DIR/$TRUSTSTORE_OUTPUT_FILENAME
   else
@@ -58,7 +58,7 @@ fi
 
 # Import Custom Certificates
 for f in $WORK_DIR/*; do
-  if [ ${f: -4} == ".pem" ]; then
+  if [ ${f: -4} = ".pem" ]; then
     echo "importing certificate: $f"
     keytool -import -file $f -alias `basename $f` -keystore $WORK_DIR/$TRUSTSTORE_OUTPUT_FILENAME -storepass $TRUSTSTORE_PASSWORD -noprompt
     if [ $? != 0 ]; then
index 37bb84d..e3cee36 100755 (executable)
@@ -32,8 +32,8 @@ DEBUG_PROP=
 # Debug Setup. Uses env variables
 # DEBUG and DEBUG_PORT
 # DEBUG=true/false | DEBUG_PORT=<Port valie must be integer>
-if [ "${DEBUG}" == "true" ]; then
-  if [ "${DEBUG_PORT}" == "" ]; then
+if [ "${DEBUG}" = "true" ]; then
+  if [ "${DEBUG_PORT}" = "" ]; then
     DEBUG_PORT=8000
   fi
   echo "Debug mode on"
index 657b5f9..1a75bd7 100755 (executable)
@@ -86,9 +86,9 @@ deploy() {
        target_machine_notice_info
 }
 
-if [[ $# -eq 1 ]] && [[ $1 == "-h" || $1 == "--help" ]]; then
+if [[ $# -eq 1 ]] && [[ $1 = "-h" || $1 = "--help" ]]; then
        usage
-elif [[ $# -eq 1 ]] && [[ $1 == "--info" ]]; then
+elif [[ $# -eq 1 ]] && [[ $1 = "--info" ]]; then
        target_machine_notice_info
 else
        deploy $@
index 6e412a3..44fe79a 100755 (executable)
@@ -76,7 +76,7 @@ manual_configuration() {
        generate_config_map $@
 }
 
-if [[ $# -eq 1 ]] && [[ $1 == "-h" || $1 == "--help" ]]; then
+if [[ $# -eq 1 ]] && [[ $1 = "-h" || $1 = "--help" ]]; then
        usage
 elif [[ $# -eq 0 ]]; then
        automatic_configuration
index ce51b30..8c01312 100755 (executable)
@@ -16,7 +16,7 @@
 
 BASE_URL="https://nexus3.onap.org/repository/docker.release"
 
-if [ "$GERRIT_BRANCH" == "staging" ]; then
+if [ "$GERRIT_BRANCH" = "staging" ]; then
     exit 0
 fi
 
index cde7d4c..7950e0c 100755 (executable)
@@ -258,14 +258,14 @@ EOF
   helm init --service-account tiller
   kubectl -n kube-system  rollout status deploy/tiller-deploy
   echo "upgrade server side of helm in kubernetes"
-  if [ "$USERNAME" == "root" ]; then
+  if [ "$USERNAME" = "root" ]; then
     helm version
   else
     sudo helm version
   fi
   echo "sleep 30"
   sleep 30
-  if [ "$USERNAME" == "root" ]; then
+  if [ "$USERNAME" = "root" ]; then
     helm init --upgrade
   else
     sudo helm init --upgrade
@@ -273,13 +273,13 @@ EOF
   echo "sleep 30"
   sleep 30
   echo "verify both versions are the same below"
-  if [ "$USERNAME" == "root" ]; then
+  if [ "$USERNAME" = "root" ]; then
     helm version
   else
     sudo helm version
   fi
   echo "start helm server"
-  if [ "$USERNAME" == "root" ]; then
+  if [ "$USERNAME" = "root" ]; then
     helm serve &
   else
     sudo helm serve &
@@ -287,7 +287,7 @@ EOF
   echo "sleep 30"
   sleep 30
   echo "add local helm repo"
-  if [ "$USERNAME" == "root" ]; then
+  if [ "$USERNAME" = "root" ]; then
     helm repo add local http://127.0.0.1:8879
     helm repo list
   else
index 3bcb404..6267a35 100755 (executable)
@@ -49,7 +49,7 @@ generate_overrides() {
   for index in "${!SUBCHART_NAMES[@]}"; do
     START=${SUBCHART_NAMES[index]}
     END=${SUBCHART_NAMES[index+1]}
-    if [[ $START == "global:" ]]; then
+    if [[ $START = "global:" ]]; then
       echo "global:" > $GLOBAL_OVERRIDES
       cat $COMPUTED_OVERRIDES | sed '/common:/,/consul:/d' \
         | sed -n '/^'"$START"'/,/'log:'/p' | sed '1d;$d' >> $GLOBAL_OVERRIDES
@@ -72,11 +72,11 @@ resolve_deploy_flags() {
   n=${#flags[*]}
   for (( i = 0; i < n; i++ )); do
     PARAM=${flags[i]}
-    if [[ $PARAM == "-f" || \
-          $PARAM == "--values" || \
-          $PARAM == "--set" || \
-          $PARAM == "--set-string" || \
-          $PARAM == "--version" ]]; then
+    if [[ $PARAM = "-f" || \
+          $PARAM = "--values" || \
+          $PARAM = "--set" || \
+          $PARAM = "--set-string" || \
+          $PARAM = "--version" ]]; then
        # skip param and its value
        i=$((i + 1))
     else
@@ -98,7 +98,7 @@ deploy() {
   FLAGS=${@:3}
   CHART_REPO="$(cut -d'/' -f1 <<<"$CHART_URL")"
   CHART_NAME="$(cut -d'/' -f2 <<<"$CHART_URL")"
-  if [[ $HELM_VER == "v3."* ]]; then
+  if [[ $HELM_VER = "v3."* ]]; then
     CACHE_DIR=~/.local/share/helm/plugins/deploy/cache
   else
     CACHE_DIR=~/.helm/plugins/deploy/cache
@@ -149,7 +149,7 @@ deploy() {
   SUBCHART_RELEASE="$(cut -d'-' -f2 <<<"$RELEASE")"
   # update specified subchart without parent
   RELEASE="$(cut -d'-' -f1 <<<"$RELEASE")"
-  if [[ $SUBCHART_RELEASE == $RELEASE ]]; then
+  if [[ $SUBCHART_RELEASE = $RELEASE ]]; then
     SUBCHART_RELEASE=
   fi
 
@@ -201,13 +201,13 @@ deploy() {
     helm upgrade -i $RELEASE $CHART_DIR $DEPLOY_FLAGS -f $COMPUTED_OVERRIDES \
      > $LOG_FILE.log 2>&1
 
-    if [[ $VERBOSE == "true" ]]; then
+    if [[ $VERBOSE = "true" ]]; then
       cat $LOG_FILE
     else
       echo "release \"$RELEASE\" deployed"
     fi
     # Add annotation last-applied-configuration if set-last-applied flag is set
-    if [[ $SET_LAST_APPLIED == "true" ]]; then
+    if [[ $SET_LAST_APPLIED = "true" ]]; then
       helm get manifest ${RELEASE} \
       | kubectl apply set-last-applied --create-annotation -n onap -f - \
       > $LOG_FILE.log 2>&1
@@ -228,7 +228,7 @@ deploy() {
     fi
 
     if [[ $SUBCHART_ENABLED -eq 1 ]]; then
-      if [[ -z "$SUBCHART_RELEASE" || $SUBCHART_RELEASE == "$subchart" ]]; then
+      if [[ -z "$SUBCHART_RELEASE" || $SUBCHART_RELEASE = "$subchart" ]]; then
         LOG_FILE=$LOG_DIR/"${RELEASE}-${subchart}".log
         :> $LOG_FILE
 
@@ -236,19 +236,19 @@ deploy() {
          $DEPLOY_FLAGS -f $GLOBAL_OVERRIDES -f $SUBCHART_OVERRIDES \
          > $LOG_FILE 2>&1
 
-        if [[ $VERBOSE == "true" ]]; then
+        if [[ $VERBOSE = "true" ]]; then
           cat $LOG_FILE
         else
           echo "release \"${RELEASE}-${subchart}\" deployed"
         fi
        # Add annotation last-applied-configuration if set-last-applied flag is set
-        if [[ $SET_LAST_APPLIED == "true" ]]; then
+        if [[ $SET_LAST_APPLIED = "true" ]]; then
           helm get manifest "${RELEASE}-${subchart}" \
           | kubectl apply set-last-applied --create-annotation -n onap -f - \
              > $LOG_FILE.log 2>&1
         fi
       fi
-         if [[ $DELAY == "true" ]]; then
+         if [[ $DELAY = "true" ]]; then
                echo sleep 3m
                sleep 3m
          fi
@@ -256,7 +256,7 @@ deploy() {
       array=($(echo "$ALL_HELM_RELEASES" | grep "${RELEASE}-${subchart}"))
       n=${#array[*]}
       for (( i = n-1; i >= 0; i-- )); do
-        if [[ $HELM_VER == "v3."* ]]; then
+        if [[ $HELM_VER = "v3."* ]]; then
           helm del "${array[i]}" 
         else
           helm del "${array[i]}" --purge
@@ -266,7 +266,7 @@ deploy() {
   done
 
   # report on success/failures of installs/upgrades
-  if [[ $HELM_VER == "v3."* ]]; then
+  if [[ $HELM_VER = "v3."* ]]; then
     helm ls --all-namespaces | grep -i FAILED | grep $RELEASE
   else
     helm ls | grep FAILED | grep $RELEASE
index 7ab384e..d48070c 100755 (executable)
@@ -63,7 +63,7 @@ usage ()
 
 # Check if execscript flag is used and drop it from input arguments
 
-if [[ "${!#}" == "execscript" ]]; then
+if [[ "${!#}" = "execscript" ]]; then
         set -- "${@:1:$#-1}"
         execscript=true
 fi
index 576b669..97f4e4d 100755 (executable)
@@ -18,7 +18,7 @@
 # Run the testsuite for the passed tag. Valid tags are listed in usage help
 # Please clean up logs when you are done...
 #
-if [ "$1" == "" ] || [ "$2" == "" ]; then
+if [ "$1" = "" ] || [ "$2" = "" ]; then
    echo "Usage: ete-k8s.sh [namespace] [tag] [execscript]"
    echo ""
    echo "  List of test case tags (filename for intent: tag)"
@@ -76,7 +76,7 @@ SCRIPTDIR=scripts/etescript
 
 ETEHOME=/var/opt/ONAP
 
-if [[ "${!#}" == "execscript" ]]; then
+if [[ "${!#}" = "execscript" ]]; then
    for script in $(ls -1 "$DIR/$SCRIPTDIR"); do
       [ -f "$DIR/$SCRIPTDIR/$script" ] && [ -x "$DIR/$SCRIPTDIR/$script" ] && source "$DIR/$SCRIPTDIR/$script"
    done
index b8b8708..2512e5f 100755 (executable)
@@ -18,7 +18,7 @@
 # Run the health-check testsuites for the tags discovered by helm list
 # Please clean up logs when you are done...
 #
-if [ "$1" == "" ] ;  then
+if [ "$1" = "" ] ;  then
    echo "Usage: eteHelm-k8s.sh [namespace] [execscript]"
    echo " list projects via helm list and runs health-check with those tags except dev and dev-consul"
    echo " [execscript] - optional parameter to execute user custom scripts located in scripts/helmscript directory"
@@ -44,7 +44,7 @@ SCRIPTDIR=scripts/helmscript
 
 ETEHOME=/var/opt/ONAP
 
-if [[ "${!#}" == "execscript" ]]; then
+if [[ "${!#}" = "execscript" ]]; then
    for script in $(ls -1 "$DIR/$SCRIPTDIR"); do
       [ -f "$DIR/$SCRIPTDIR/$script" ] && [ -x "$DIR/$SCRIPTDIR/$script" ] && source "$DIR/$SCRIPTDIR/$script"
    done
index 5a53fa1..feb6662 100755 (executable)
@@ -17,7 +17,7 @@
 */}}
 
 debugLog(){
-  if [ "$enableDebugLogging" == true ]; then
+  if [ "$enableDebugLogging" = true ]; then
      if [ $# -eq 0 ]; then
        echo "" >> $LOGFILE
      else
index 9c81069..9485833 100755 (executable)
@@ -17,7 +17,7 @@
 */}}
 
 debugLog(){
-  if [ "$enableDebugLogging" == true ]; then
+  if [ "$enableDebugLogging" = true ]; then
      if [ $# -eq 0 ]; then
        echo "" >> $LOGFILE
      else
index 7764d00..fa76a9e 100755 (executable)
@@ -24,7 +24,7 @@ fi
 
 # should PROM start as passive?
 state=$( bin/sdnc.cluster )
-if [ "$state" == "standby" ]; then
+if [ "$state" = "standby" ]; then
   echo "Starting PROM in passive mode"
   passive="-p"
 fi
index 8057547..c36d2e3 100755 (executable)
@@ -26,7 +26,7 @@ LOGFILE="/app/geo.log"
 enableDebugLogging=true
 
 debugLog(){
-  if [ "$enableDebugLogging" == true ]; then
+  if [ "$enableDebugLogging" = true ]; then
      if [ $# -eq 0 ]; then
        echo "" >> $LOGFILE
      else