From 5d0458470419e87cb925a50859e7bd9979bfe388 Mon Sep 17 00:00:00 2001 From: David Hill Date: Tue, 6 Nov 2018 15:35:47 -0600 Subject: [PATCH] MCOL-520 - changes for mysql_upgrade requiring password --- oam/install_scripts/module_installer.sh | 12 +++++++++++- oamapps/postConfigure/helpers.cpp | 8 +++++++- procmon/main.cpp | 9 ++++++++- procmon/processmonitor.cpp | 2 +- 4 files changed, 27 insertions(+), 4 deletions(-) diff --git a/oam/install_scripts/module_installer.sh b/oam/install_scripts/module_installer.sh index 0e116a597..c2c48af43 100755 --- a/oam/install_scripts/module_installer.sh +++ b/oam/install_scripts/module_installer.sh @@ -15,6 +15,7 @@ rpmmode=install user=`whoami 2>/dev/null` quiet=0 shiftcnt=0 +password=" " for arg in "$@"; do if [ $(expr -- "$arg" : '--prefix=') -eq 9 ]; then @@ -40,6 +41,9 @@ for arg in "$@"; do elif [ $(expr -- "$arg" : '--module') -eq 8 ]; then module="$(echo $arg | awk -F= '{print $2}')" ((shiftcnt++)) + elif [ $(expr -- "$arg" : '--password') -eq 10 ]; then + password="$(echo $arg | awk -F= '{print $2}')" + ((shiftcnt++)) fi done shift $shiftcnt @@ -155,9 +159,15 @@ if [ $module = "um" ] || ( [ $module = "pm" ] && [ $PMwithUM = "y" ] ) || [ $Ser echo "ERROR: post-mysqld-install failed: check ${tmpDir}/post-mysqld-install.log" exit 1 fi + echo "Run post-mysql-install" - $COLUMNSTORE_INSTALL_DIR/bin/post-mysql-install --installdir=$COLUMNSTORE_INSTALL_DIR --tmpdir=${tmpDir} > ${tmpDir}/post-mysql-install.log 2>&1 + mysqlPassword=" " + if [[ $password != " " ]]; then + mysqlPassword="--password="$password + fi + + $COLUMNSTORE_INSTALL_DIR/bin/post-mysql-install --installdir=$COLUMNSTORE_INSTALL_DIR $mysqlPassword --tmpdir=${tmpDir} > ${tmpDir}/post-mysql-install.log 2>&1 if [ $? -ne 0 ]; then echo "ERROR: post-mysql-install failed: check ${tmpDir}/post-mysql-install.log" exit 1 diff --git a/oamapps/postConfigure/helpers.cpp b/oamapps/postConfigure/helpers.cpp index 75f0d43ec..322ecb6c3 100644 --- a/oamapps/postConfigure/helpers.cpp +++ b/oamapps/postConfigure/helpers.cpp @@ -282,8 +282,14 @@ void mysqlSetup() if (p && *p) HOME = p; } + + string mysqlpw = oam.getMySQLPassword(); - cmd = installDir + "/bin/post-mysql-install --installdir=" + installDir + " --tmpdir=" + tmpDir + " > " + tmpDir + "/post-mysql-install.log"; + string passwordOption = ""; + if ( mysqlpw != oam::UnassignedName ) + passwordOption = " --password=" + mysqlpw; + + cmd = installDir + "/bin/post-mysql-install --installdir=" + installDir + " --tmpdir=" + tmpDir + " " + passwordOption + " > " + tmpDir + "/post-mysql-install.log"; rtnCode = system(cmd.c_str()); if (WEXITSTATUS(rtnCode) == 2) diff --git a/procmon/main.cpp b/procmon/main.cpp index 02ad7abbb..0d2d2ab4a 100644 --- a/procmon/main.cpp +++ b/procmon/main.cpp @@ -242,9 +242,16 @@ int main(int argc, char** argv) } string modType = config.moduleType(); + + string mysqlpw = oam.getMySQLPassword(); + + string passwordOption = ""; + if ( mysqlpw != oam::UnassignedName ) + passwordOption = " --password=" + mysqlpw; + //run the module install script - string cmd = startup::StartUp::installDir() + "/bin/module_installer.sh " + " --installdir=" + startup::StartUp::installDir() + " --module=" + modType + " > " + tmpLogDir + "/module_installer.log 2>&1"; + string cmd = startup::StartUp::installDir() + "/bin/module_installer.sh " + " --installdir=" + startup::StartUp::installDir() + " --module=" + modType + " " + passwordOption + " > " + tmpLogDir + "/module_installer.log 2>&1"; log.writeLog(__LINE__, "run module_installer.sh", LOG_TYPE_DEBUG); log.writeLog(__LINE__, cmd, LOG_TYPE_DEBUG); diff --git a/procmon/processmonitor.cpp b/procmon/processmonitor.cpp index 2f6a5ab9d..b92ab2b6f 100644 --- a/procmon/processmonitor.cpp +++ b/procmon/processmonitor.cpp @@ -6588,7 +6588,7 @@ int ProcessMonitor::runUpgrade() string mysqlpw = oam.getMySQLPassword(); - string passwordOption = passwordOption = ""; + string passwordOption = ""; if ( mysqlpw != oam::UnassignedName ) passwordOption = " --password=" + mysqlpw;