From 90d4b03fdb5d4b7b18f74d853f12c4ba046f58f3 Mon Sep 17 00:00:00 2001 From: Patrick LeBlanc Date: Tue, 17 Mar 2020 13:55:08 -0400 Subject: [PATCH] MCOL-3743: cmdline params to postConfig to configure SM Made some changes. It's working the way it should. --- .../columnstore-post-install.in | 1 - oamapps/postConfigure/postConfigure.cpp | 39 +++++++++++-------- storage-manager/CMakeLists.txt | 10 ++++- 3 files changed, 31 insertions(+), 19 deletions(-) diff --git a/oam/install_scripts/columnstore-post-install.in b/oam/install_scripts/columnstore-post-install.in index 5cb22c35e..adac6f228 100755 --- a/oam/install_scripts/columnstore-post-install.in +++ b/oam/install_scripts/columnstore-post-install.in @@ -32,7 +32,6 @@ if [ ! -f @ENGINE_SYSCONFDIR@/columnstore/Columnstore.xml ]; then fi if [ -f @ENGINE_SYSCONFDIR@/columnstore/storagemanager.cnf.rpmsave ]; then - /bin/cp -f @ENGINE_SYSCONFDIR@/columnstore/storagemanager.cnf @ENGINE_SYSCONFDIR@/columnstore/storagemanager.cnf.new /bin/cp -f @ENGINE_SYSCONFDIR@/columnstore/storagemanager.cnf.rpmsave @ENGINE_SYSCONFDIR@/columnstore/storagemanager.cnf fi diff --git a/oamapps/postConfigure/postConfigure.cpp b/oamapps/postConfigure/postConfigure.cpp index d48d335b0..46e95716d 100644 --- a/oamapps/postConfigure/postConfigure.cpp +++ b/oamapps/postConfigure/postConfigure.cpp @@ -242,12 +242,8 @@ void modifySMConfigFile() tmp = s3Location + "/storagemanager/path"; smConfig.put("LocalStorage.path", tmp.normalize().string()); tmp = s3Location + "/storagemanager/cache"; - smConfig.put("Cache.path", s3Location + tmp.normalize().string()); + smConfig.put("Cache.path", tmp.normalize().string()); } - - // save a copy of the original to preserve the in-line documentation - if (!boost::filesystem::exists(smConfigFile + ".original")) - boost::filesystem::copy_file(smConfigFile, smConfigFile + ".original"); boost::property_tree::ini_parser::write_ini(smConfigFile, smConfig); } @@ -341,7 +337,7 @@ int main(int argc, char* argv[]) cout << " (percentages of the total memory need to be stated with suffix %, explcit values with suffixes M or G)" << endl; cout << endl; cout << " S3-compat storage quick-configure options:" << endl; - cout << " (See /etc/columnstore/storagemanager.cnf for more information on these)" << endl; + cout << " (See /etc/columnstore/storagemanager.cnf.example for more information on these)" << endl; cout << " -sm-bucket bucket The bucket to use." << endl; cout << " -sm-region region The region to use." << endl; cout << " -sm-id id The ID to use; equivalent to AWS_ACCESS_KEY_ID in AWS" << endl; @@ -355,7 +351,7 @@ int main(int argc, char* argv[]) { if (++i == argc) { - cout << " ERROR: S3 bucket not provided" << endl; + cout << " ERROR: StorageManager bucket not provided" << endl; exit(1); } s3Bucket = argv[i]; @@ -365,7 +361,7 @@ int main(int argc, char* argv[]) { if (++i == argc) { - cout << " ERROR: S3 region not provided" << endl; + cout << " ERROR: StorageManager region not provided" << endl; exit(1); } s3Region = argv[i]; @@ -375,7 +371,7 @@ int main(int argc, char* argv[]) { if (++i == argc) { - cout << " ERROR: S3 ID not provided" << endl; + cout << " ERROR: StorageManager ID not provided" << endl; exit(1); } s3Key = argv[i]; @@ -385,7 +381,7 @@ int main(int argc, char* argv[]) { if (++i == argc) { - cout << " ERROR: S3 secret not provided" << endl; + cout << " ERROR: StorageManager secret not provided" << endl; exit(1); } s3Secret = argv[i]; @@ -395,7 +391,7 @@ int main(int argc, char* argv[]) { if (++i == argc) { - cout << " ERROR: S3 endpoint not provided" << endl; + cout << " ERROR: StorageManager endpoint not provided" << endl; exit(1); } s3Endpoint = argv[i]; @@ -405,17 +401,17 @@ int main(int argc, char* argv[]) { if (++i == argc) { - cout << " ERROR: S3 cache size not provided" << endl; + cout << " ERROR: StorageManager cache size not provided" << endl; exit(1); } s3CacheSize = argv[i]; configureS3 = true; } - else if (strcmp("-sm-location", argv[i]) == 0) + else if (strcmp("-sm-prefix", argv[i]) == 0) { if (++i == argc) { - cout << " ERROR: S3 location not provided" << endl; + cout << " ERROR: StorageManager prefix not provided" << endl; exit(1); } s3Location = argv[i]; @@ -5013,8 +5009,19 @@ bool storageSetup(bool amazonInstall) storageManagerInstalled = boost::filesystem::exists(storageManagerLocation); if (configureS3) - modifySMConfigFile(); - + { + try + { + modifySMConfigFile(); + } + catch (exception &e) + { + cerr << "There was an error processing the StorageManager command-line options." << endl; + cerr << "Got: " << e.what() << endl; + exit(1); + } + } + // // get Backend Data storage type // diff --git a/storage-manager/CMakeLists.txt b/storage-manager/CMakeLists.txt index d63fe8296..6be5a3b9e 100755 --- a/storage-manager/CMakeLists.txt +++ b/storage-manager/CMakeLists.txt @@ -134,8 +134,14 @@ install(TARGETS StorageManager smcat smput smls smrm COMPONENT columnstore-platform ) - install(FILES storagemanager.cnf DESTINATION ${ENGINE_SYSCONFDIR}/columnstore - COMPONENT columnstore-platform) + COMPONENT columnstore-platform +) + +install(FILES storagemanager.cnf + RENAME storagemanager.cnf.example + DESTINATION ${ENGINE_SYSCONFDIR}/columnstore + COMPONENT columnstore-platform +)