From 16f22c2c70d4b7e34480051142e6941f73ca76a5 Mon Sep 17 00:00:00 2001 From: david hill Date: Wed, 24 May 2017 14:25:53 -0500 Subject: [PATCH] MCOL-522 - add installedd version verify --- oamapps/postConfigure/postConfigure.cpp | 17 ++++++++++++++++- procmgr/processmanager.cpp | 17 +++++++++++++++++ 2 files changed, 33 insertions(+), 1 deletion(-) diff --git a/oamapps/postConfigure/postConfigure.cpp b/oamapps/postConfigure/postConfigure.cpp index 80bb78060..0eef1f471 100644 --- a/oamapps/postConfigure/postConfigure.cpp +++ b/oamapps/postConfigure/postConfigure.cpp @@ -2917,10 +2917,25 @@ int main(int argc, char *argv[]) string cmd = installDir + "/bin/remote_command.sh " + remoteModuleIP + " " + password + " 'ls " + installDir + "/bin/post-install' > /tmp/install_check.log"; int rtnCode = system(cmd.c_str()); if (WEXITSTATUS(rtnCode) != 0) { - cout << endl << "Error: MariaDB ColumnStore not installed on " + remoteModuleName + " / " + remoteHostName << endl; + cout << "Error: MariaDB ColumnStore not installed on " + remoteModuleName + " / " + remoteHostName << endl; cout << "Install and re-run postConfigure. Exiting..." << endl << endl; exit(1); } + //check version that is installed + cmd = installDir + "/bin/remote_scp_get.sh " + remoteModuleIP + " " + password + " " + installDir + "/releasenum > /dev/null 2>&1"; + rtnCode = system(cmd.c_str()); + if (WEXITSTATUS(rtnCode) != 0) { + cout << "Error: MariaDB ColumnStore not installed on " + remoteModuleName + " / " + remoteHostName << endl; + cout << "Install and re-run postConfigure. Exiting..." << endl << endl; + exit(1); + } + cmd = "diff " + installDir + "/releasenum releasenum > /dev/null 2>&1"; + rtnCode = system(cmd.c_str()); + if (WEXITSTATUS(rtnCode) != 0) { + cout << "Error: Local version of MariaDB ColumnStore doesn't match installed version on " + remoteModuleName + " / " + remoteHostName << endl; + cout << "Install matching version and re-run postConfigure. Exiting..." << endl << endl; + exit(1); + } } else cout << endl << "----- Performing Install on '" + remoteModuleName + " / " + remoteHostName + "' -----" << endl << endl; diff --git a/procmgr/processmanager.cpp b/procmgr/processmanager.cpp index 922def960..f8bf21b3d 100644 --- a/procmgr/processmanager.cpp +++ b/procmgr/processmanager.cpp @@ -5074,6 +5074,23 @@ int ProcessManager::addModule(oam::DeviceNetworkList devicenetworklist, std::str pthread_mutex_unlock(&THREAD_LOCK); return API_FAILURE; } + + //check version that is installed + cmd = installDir + "/bin/remote_scp_get.sh " + remoteModuleIP + " " + password + " " + installDir + "/releasenum > /dev/null 2>&1"; + rtnCode = system(cmd.c_str()); + if (WEXITSTATUS(rtnCode) != 0) { + log.writeLog(__LINE__, "addModule - ERROR: MariaDB ColumnStore not installed on " + remoteModuleName + " / " + remoteHostName , LOG_TYPE_ERROR); + pthread_mutex_unlock(&THREAD_LOCK); + return API_FAILURE; + } + cmd = "diff " + installDir + "/releasenum releasenum > /dev/null 2>&1"; + rtnCode = system(cmd.c_str()); + if (WEXITSTATUS(rtnCode) != 0) { + log.writeLog(__LINE__, "addModule - ERROR: Local version of MariaDB ColumnStore doesn't match installed version on " + remoteModuleName + " / " + remoteHostName , LOG_TYPE_ERROR); + pthread_mutex_unlock(&THREAD_LOCK); + return API_FAILURE; + } + } //run installer on remote module