Allow for mysql command flags in db-migrator 49/131149/1
authorjhh <jorge.hernandez-herrero@att.com>
Fri, 23 Sep 2022 13:32:21 +0000 (08:32 -0500)
committerjhh <jorge.hernandez-herrero@att.com>
Fri, 23 Sep 2022 13:33:26 +0000 (08:33 -0500)
For example by setting the env var to
MYSQL_CMD="mysql --ssl"

Issue-ID: POLICY-4182
Signed-off-by: jhh <jorge.hernandez-herrero@att.com>
Change-Id: If7298fb2ea01f15324a526e49f2ec860d29f8d31

csit/config/db/db.conf
policy-db-migrator/src/main/docker/db-migrator

index 22b37f8..29638c8 100644 (file)
@@ -14,3 +14,4 @@
 MYSQL_ROOT_PASSWORD=secret
 MYSQL_USER=policy_user
 MYSQL_PASSWORD=policy_user
+MYSQL_CMD=mysql
index 565ff1c..3a4ccfa 100755 (executable)
@@ -621,7 +621,11 @@ if [ -z "${SQL_HOST}" ] || [ -z "${SQL_USER}" ] || [ -z "${SQL_PASSWORD}" ]; the
     exit 4
 fi
 
-MYSQL="mysql -u${SQL_USER} -p${SQL_PASSWORD} -h ${SQL_HOST}"
+if [ -z "$MYSQL_CMD" ]; then
+    MYSQL_CMD="mysql"
+fi
+
+MYSQL="${MYSQL_CMD} -u${SQL_USER} -p${SQL_PASSWORD} -h ${SQL_HOST}"
 if ! ${MYSQL} -h"${SQL_HOST}" --execute "show databases;" >/dev/null 2>&1; then
     echo "error: No DB connectivity to ${SQL_HOST} for ${SQL_USER}"
     exit 5