From 3fd1afa90413fbd978766f8bdb68dd7e7a8b5ac5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Vin=C3=ADcius=20Ferr=C3=A3o?= Date: Sat, 11 May 2024 16:34:00 -0300 Subject: [PATCH] Fixes RELEASE builds MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Vinícius Ferrão --- .idea/codeStyles/Project.xml | 3 + CMakePresets.json | 4 +- include/cloysterhpc/services/log.h | 6 +- include/cloysterhpc/view/newt.h | 6 +- src/answerfile.cpp | 4 +- src/cluster.cpp | 70 +++++++++---------- src/connection.cpp | 10 +-- src/diskImage.cpp | 8 +-- src/functions.cpp | 42 +++++------ src/main.cpp | 14 ++-- src/network.cpp | 8 +-- src/os.cpp | 14 ++-- src/presenter/PresenterGeneralSettings.cpp | 6 +- src/presenter/PresenterHostId.cpp | 8 +-- src/presenter/PresenterInfiniband.cpp | 2 +- src/presenter/PresenterInstructions.cpp | 2 +- src/presenter/PresenterMailSystem.cpp | 2 +- src/presenter/PresenterNetwork.cpp | 4 +- .../PresenterNodesOperationalSystem.cpp | 2 +- src/presenter/PresenterTime.cpp | 4 +- src/presenter/PresenterWelcome.cpp | 2 +- src/server.cpp | 2 +- src/services/shell.cpp | 46 ++++++------ src/services/timezone.cpp | 4 +- src/services/xcat.cpp | 6 +- src/view/newt.cpp | 2 +- 26 files changed, 142 insertions(+), 139 deletions(-) diff --git a/.idea/codeStyles/Project.xml b/.idea/codeStyles/Project.xml index 640f8e6..c7dec25 100644 --- a/.idea/codeStyles/Project.xml +++ b/.idea/codeStyles/Project.xml @@ -4,6 +4,9 @@ + + diff --git a/CMakePresets.json b/CMakePresets.json index c9ce46b..55256f3 100644 --- a/CMakePresets.json +++ b/CMakePresets.json @@ -51,7 +51,7 @@ "cacheVariables": { "CMAKE_C_COMPILER": "gcc", "CMAKE_CXX_COMPILER": "g++", - "CMAKE_BUILD_TYPE": "RelWithDebInfo" + "CMAKE_BUILD_TYPE": "Release" } }, { @@ -73,7 +73,7 @@ "cacheVariables": { "CMAKE_C_COMPILER": "clang", "CMAKE_CXX_COMPILER": "clang++", - "CMAKE_BUILD_TYPE": "RelWithDebInfo" + "CMAKE_BUILD_TYPE": "Release" } } ], diff --git a/include/cloysterhpc/services/log.h b/include/cloysterhpc/services/log.h index b37c8e3..e7fc11a 100644 --- a/include/cloysterhpc/services/log.h +++ b/include/cloysterhpc/services/log.h @@ -54,9 +54,9 @@ } #else // Disabled for RELEASE builds -#define LOG_TRACE(...) (void)0 -#define LOG_DEBUG(...) (void)0 -#define LOG_ASSERT(x, msg) (void)0 +#define LOG_TRACE(...) (void)0; +#define LOG_DEBUG(...) (void)0; +#define LOG_ASSERT(x, msg) (void)0; #endif namespace Log { diff --git a/include/cloysterhpc/view/newt.h b/include/cloysterhpc/view/newt.h index 08fb39f..365b870 100644 --- a/include/cloysterhpc/view/newt.h +++ b/include/cloysterhpc/view/newt.h @@ -142,10 +142,10 @@ class Newt : public View { for (const auto& string : tempStrings) { cStrings.push_back(string.c_str()); - LOG_TRACE("Pushed back std::string {}", string.c_str()); + LOG_TRACE("Pushed back std::string {}", string.c_str()) } cStrings.push_back(nullptr); - LOG_TRACE("Pushed back nullptr"); + LOG_TRACE("Pushed back nullptr") #if 1 // goto implementation @@ -231,7 +231,7 @@ class Newt : public View { for (std::size_t i = 0; i < arraySize; i++) { field[i].text = const_cast(items[i].first.c_str()); fieldEntries[i] = const_cast((items[i].second).c_str()); - LOG_TRACE("fieldEntries[{}] = {}", i, fieldEntries[i]); + LOG_TRACE("fieldEntries[{}] = {}", i, fieldEntries[i]) // TODO: Check is there's a way to hide & field[i].value = &fieldEntries[i]; diff --git a/src/answerfile.cpp b/src/answerfile.cpp index e2410f8..0f5c41f 100644 --- a/src/answerfile.cpp +++ b/src/answerfile.cpp @@ -28,7 +28,7 @@ void AnswerFile::loadFile(const std::filesystem::path& path) void AnswerFile::loadOptions() { - LOG_TRACE("Verify answerfile variables"); + LOG_TRACE("Verify answerfile variables") loadExternalNetwork(); loadManagementNetwork(); @@ -236,7 +236,7 @@ void AnswerFile::loadNodes() break; } - LOG_TRACE("Configure {}", nodeSection); + LOG_TRACE("Configure {}", nodeSection) AFNode newNode = loadNode(nodeSection); if (newNode.hostname->empty()) { diff --git a/src/cluster.cpp b/src/cluster.cpp index 70ca105..de6e7b1 100644 --- a/src/cluster.cpp +++ b/src/cluster.cpp @@ -3,6 +3,7 @@ * SPDX-License-Identifier: Apache-2.0 */ +#include #include #include #include @@ -19,7 +20,6 @@ #include #ifndef NDEBUG -#include "cloysterhpc/answerfile.h" #include #endif @@ -276,7 +276,7 @@ void Cluster::printNetworks( const std::list>& networks) const { - LOG_DEBUG("Dump network data:"); + LOG_DEBUG("Dump network data:") #if __cplusplus < 202002L size_t i, j; @@ -285,20 +285,20 @@ void Cluster::printNetworks( #else for (size_t i = 0; const auto& network : networks) { #endif - LOG_DEBUG("Network [{}]", i++); - LOG_DEBUG("Profile: {}", magic_enum::enum_name(network->getProfile())); - LOG_DEBUG("Address: {}", network->getAddress().to_string()); - LOG_DEBUG("Subnet Mask: {}", network->getSubnetMask().to_string()); - LOG_DEBUG("Gateway: {}", network->getGateway().to_string()); - LOG_DEBUG("VLAN: {}", network->getVLAN()); - LOG_DEBUG("Domain Name: {}", network->getDomainName()); + LOG_DEBUG("Network [{}]", i++) + LOG_DEBUG("Profile: {}", magic_enum::enum_name(network->getProfile())) + LOG_DEBUG("Address: {}", network->getAddress().to_string()) + LOG_DEBUG("Subnet Mask: {}", network->getSubnetMask().to_string()) + LOG_DEBUG("Gateway: {}", network->getGateway().to_string()) + LOG_DEBUG("VLAN: {}", network->getVLAN()) + LOG_DEBUG("Domain Name: {}", network->getDomainName()) #if __cplusplus < 202002L j = 0; for (const auto& nameserver : network.getNameserver()) { #else for (size_t j = 0; const auto& nameserver : network->getNameservers()) { #endif - LOG_DEBUG("Nameserver [{}]: {}", j++, nameserver.to_string()); + LOG_DEBUG("Nameserver [{}]: {}", j++, nameserver.to_string()) } } } @@ -312,31 +312,31 @@ void Cluster::printConnections() void Cluster::printData() { - LOG_DEBUG("Dump cluster data:"); - LOG_DEBUG("Cluster attributes defined:"); + LOG_DEBUG("Dump cluster data:") + LOG_DEBUG("Cluster attributes defined:") LOG_DEBUG("OS Data:") m_headnode.getOS().printData(); - LOG_DEBUG("Timezone: {}", getTimezone().getTimezone()); - LOG_DEBUG("Locale: {}", getLocale().getLocale()); - LOG_DEBUG("Hostname: {}", this->m_headnode.getHostname()); - LOG_DEBUG("DomainName: {}", getDomainName()); - LOG_DEBUG("FQDN: {}", this->m_headnode.getFQDN()); + LOG_DEBUG("Timezone: {}", getTimezone().getTimezone()) + LOG_DEBUG("Locale: {}", getLocale().getLocale()) + LOG_DEBUG("Hostname: {}", this->m_headnode.getHostname()) + LOG_DEBUG("DomainName: {}", getDomainName()) + LOG_DEBUG("FQDN: {}", this->m_headnode.getFQDN()) printNetworks(m_network); printConnections(); - LOG_DEBUG("Provisioner: {}", static_cast(getProvisioner())); - // LOG_DEBUG("nodePrefix: {}", nodePrefix); - // LOG_DEBUG("nodePadding: {}", nodePadding); - // LOG_DEBUG("nodeStartIP: {}", nodeStartIP); - // LOG_DEBUG("nodeRootPassword: {}", nodeRootPassword); - LOG_DEBUG("nodeDiskImage: {}", getDiskImage().string()); + LOG_DEBUG("Provisioner: {}", static_cast(getProvisioner())) + // LOG_DEBUG("nodePrefix: {}", nodePrefix) + // LOG_DEBUG("nodePadding: {}", nodePadding) + // LOG_DEBUG("nodeStartIP: {}", nodeStartIP) + // LOG_DEBUG("nodeRootPassword: {}", nodeRootPassword) + LOG_DEBUG("nodeDiskImage: {}", getDiskImage().string()) - LOG_DEBUG("Update system: {}", (isUpdateSystem() ? "true" : "false")); - // LOG_DEBUG("Remote access: {}", (remoteAccess ? "true" : "false")); + LOG_DEBUG("Update system: {}", (isUpdateSystem() ? "true" : "false")) + // LOG_DEBUG("Remote access: {}", (remoteAccess ? "true" : "false")) - LOG_DEBUG("Firewall: {}", (isFirewall() ? "true" : "false")); - LOG_DEBUG("SELinux: {}", static_cast(getSELinux())); + LOG_DEBUG("Firewall: {}", (isFirewall() ? "true" : "false")) + LOG_DEBUG("SELinux: {}", static_cast(getSELinux())) } void Cluster::fillTestData() @@ -430,7 +430,7 @@ void Cluster::fillData(const std::string& answerfilePath) AnswerFile answerfile(answerfilePath); - LOG_TRACE("Configure Management Network"); + LOG_TRACE("Configure Management Network") // Management Network auto managementNetwork = std::make_unique( Network::Profile::Management, Network::Type::Ethernet); @@ -454,7 +454,7 @@ void Cluster::fillData(const std::string& answerfilePath) managementNetwork->setAddress(managementNetwork->calculateAddress( answerfile.management.con_ip_addr.value())); - LOG_TRACE("Configure External Network"); + LOG_TRACE("Configure External Network") // External Network auto externalNetwork = std::make_unique( Network::Profile::External, Network::Type::Ethernet); @@ -495,7 +495,7 @@ void Cluster::fillData(const std::string& answerfilePath) nodeOS.setKernel(answerfile.system.kernel); nodeOS.setVersion(answerfile.system.version); - LOG_TRACE("Cluster name: {}", answerfile.information.cluster_name); + LOG_TRACE("Cluster name: {}", answerfile.information.cluster_name) setName(answerfile.information.cluster_name); setCompanyName(answerfile.information.company_name); @@ -515,7 +515,7 @@ void Cluster::fillData(const std::string& answerfilePath) addNetwork(std::move(managementNetwork)); - LOG_TRACE("Configure Management Connection"); + LOG_TRACE("Configure Management Connection") auto managementConnection = Connection(&getNetwork(Network::Profile::Management)); managementConnection.setInterface( @@ -531,7 +531,7 @@ void Cluster::fillData(const std::string& answerfilePath) addNetwork(std::move(externalNetwork)); - LOG_TRACE("Configure External Connection"); + LOG_TRACE("Configure External Connection") auto externalConnection = Connection(&getNetwork(Network::Profile::External)); externalConnection.setInterface(answerfile.external.con_interface.value()); @@ -561,7 +561,7 @@ void Cluster::fillData(const std::string& answerfilePath) // Infiniband (Application) Network if (answerfile.application.con_interface.has_value()) { - LOG_TRACE("Configure Application Network"); + LOG_TRACE("Configure Application Network") auto applicationNetwork = std::make_unique( Network::Profile::Application, Network::Type::Ethernet); @@ -605,10 +605,10 @@ void Cluster::fillData(const std::string& answerfilePath) setProvisioner(Provisioner::xCAT); m_headnode.setOS(nodeOS); - LOG_TRACE("Configure Nodes"); + LOG_TRACE("Configure Nodes") for (auto node : answerfile.nodes.nodes) { - LOG_TRACE("Configure node {}", node.hostname.value()); + LOG_TRACE("Configure node {}", node.hostname.value()) std::list nodeConnections; auto& connection = nodeConnections.emplace_back( diff --git a/src/connection.cpp b/src/connection.cpp index c569f60..1ad6f9e 100644 --- a/src/connection.cpp +++ b/src/connection.cpp @@ -71,7 +71,7 @@ std::optional Connection::getInterface() const void Connection::setInterface(std::string_view interface) { - LOG_DEBUG("Checking if interface {} exists", interface); + LOG_DEBUG("Checking if interface {} exists", interface) if (interface == "lo") throw std::runtime_error("Cannot use the loopback interface"); @@ -136,7 +136,7 @@ std::optional Connection::getMAC() const { return m_mac; } void Connection::setMAC(std::string_view mac) { - LOG_DEBUG("Checking MAC address: {}", mac); + LOG_DEBUG("Checking MAC address: {}", mac) if ((mac.size() != 12) && (mac.size() != 14) && (mac.size() != 17)) throw std::runtime_error("Invalid MAC address size"); @@ -305,9 +305,9 @@ void Connection::dumpConnection() const magic_enum::enum_name(m_network->getProfile()), magic_enum::enum_name(m_network->getType())); - LOG_DEBUG("Interface: {}", m_interface.value_or("NONE")); - LOG_DEBUG("MAC Address: {}", m_mac.value_or("NONE")); - LOG_DEBUG("IP Address: {}", getAddress().to_string()); + LOG_DEBUG("Interface: {}", m_interface.value_or("NONE")) + LOG_DEBUG("MAC Address: {}", m_mac.value_or("NONE")) + LOG_DEBUG("IP Address: {}", getAddress().to_string()) LOG_DEBUG("===================================") } diff --git a/src/diskImage.cpp b/src/diskImage.cpp index ea6b6ea..77b3cd7 100644 --- a/src/diskImage.cpp +++ b/src/diskImage.cpp @@ -30,7 +30,7 @@ bool DiskImage::isKnownImage(const std::filesystem::path& path) { for (const auto& image : m_knownImageFilename) if (path.filename().string() == image) { - LOG_TRACE("Disk image is recognized"); + LOG_TRACE("Disk image is recognized") return true; } @@ -42,11 +42,11 @@ bool DiskImage::isKnownImage(const std::filesystem::path& path) bool DiskImage::hasVerifiedChecksum(const std::filesystem::path& path) { if (!isKnownImage(path)) { - LOG_TRACE("Disk image is unknown. Can't verify checksum"); + LOG_TRACE("Disk image is unknown. Can't verify checksum") return false; } - LOG_TRACE("Verifying disk image checksum... This may take a while"); + LOG_TRACE("Verifying disk image checksum... This may take a while") std::unordered_map hash_map = { { "rhel-8.8-x86_64-dvd.iso", @@ -82,7 +82,7 @@ bool DiskImage::hasVerifiedChecksum(const std::filesystem::path& path) filter.release(); if (output == isoHash) { - LOG_TRACE("Checksum - The disk image is valid"); + LOG_TRACE("Checksum - The disk image is valid") return true; } diff --git a/src/functions.cpp b/src/functions.cpp index 9a53e5c..7d0c204 100644 --- a/src/functions.cpp +++ b/src/functions.cpp @@ -21,7 +21,7 @@ namespace cloyster { CommandProxy runCommandIter(const std::string& command, bool overrideDryRun) { if (!cloyster::dryRun || overrideDryRun) { - LOG_DEBUG("Running command: {}", command); + LOG_DEBUG("Running command: {}", command) boost::process::ipstream pipe_stream; boost::process::child child( command, boost::process::std_out > pipe_stream); @@ -41,7 +41,7 @@ int runCommand(const std::string& command, { if (!cloyster::dryRun || overrideDryRun) { - LOG_DEBUG("Running command: {}", command); + LOG_DEBUG("Running command: {}", command) boost::process::ipstream pipe_stream; boost::process::child child( command, boost::process::std_out > pipe_stream); @@ -50,15 +50,15 @@ int runCommand(const std::string& command, while ( pipe_stream && std::getline(pipe_stream, line) && !line.empty()) { - LOG_TRACE("{}", line); + LOG_TRACE("{}", line) output.emplace_back(line); } child.wait(); - LOG_DEBUG("Exit code: {}", child.exit_code()); + LOG_DEBUG("Exit code: {}", child.exit_code()) return child.exit_code(); } else { - LOG_WARN("Dry Run: {}", command); + LOG_WARN("Dry Run: {}", command) return 0; } } @@ -91,13 +91,13 @@ std::string readConfig(const std::string& filename) } catch (boost::property_tree::ini_parser_error& ex) { - LOG_ERROR("Error: {}", ex.what()); + LOG_ERROR("Error: {}", ex.what()) } std::string value = tree.get("headnode.LANG", "en_US.utf8"); - LOG_TRACE("Read configFile variables:"); - LOG_TRACE("LANG: {}", value); + LOG_TRACE("Read configFile variables:") + LOG_TRACE("LANG: {}", value) return value; } @@ -115,29 +115,29 @@ void writeConfig(const std::string& filename) void createDirectory(const std::filesystem::path& path) { if (cloyster::dryRun) { - LOG_INFO("Would create directory {}", path.string()); + LOG_INFO("Would create directory {}", path.string()) return; } std::filesystem::create_directories(path); - LOG_DEBUG("Created directory: {}", path.string()); + LOG_DEBUG("Created directory: {}", path.string()) } /* Remove file */ void removeFile(std::string_view filename) { if (cloyster::dryRun) { - LOG_INFO("Would remove file {}, if exists", filename); + LOG_INFO("Would remove file {}, if exists", filename) return; } - LOG_DEBUG("Checking if file {} already exists on filesystem", filename); + LOG_DEBUG("Checking if file {} already exists on filesystem", filename) if (std::filesystem::exists(filename)) { - LOG_DEBUG("Already exists"); + LOG_DEBUG("Already exists") std::filesystem::remove(filename); - LOG_DEBUG("File {} deleted", filename); + LOG_DEBUG("File {} deleted", filename) } else { - LOG_DEBUG("File does not exist"); + LOG_DEBUG("File does not exist") } } @@ -159,7 +159,7 @@ void backupFile(std::string_view filename) if (!file.is_open()) { // Backup the file std::filesystem::copy_file(filename, backupFile); - LOG_DEBUG("Created a backup copy of {} on {}", filename, backupFile); + LOG_DEBUG("Created a backup copy of {} on {}", filename, backupFile) } } @@ -183,7 +183,7 @@ void changeValueInConfigurationFile( try { boost::property_tree::ini_parser::read_ini(filename, tree); } catch (boost::property_tree::ini_parser_error& ex) { - LOG_ERROR("Error: {}", ex.what()); + LOG_ERROR("Error: {}", ex.what()) } tree.put(key, value); @@ -198,7 +198,7 @@ void addStringToFile(std::string_view filename, std::string_view string) (std::istreambuf_iterator())); if (content.find(string) != std::string::npos) { - LOG_DEBUG("File {} already contains line(s):\n{}\n", filename, string); + LOG_DEBUG("File {} already contains line(s):\n{}\n", filename, string) return; } @@ -209,8 +209,8 @@ void addStringToFile(std::string_view filename, std::string_view string) #endif if (cloyster::dryRun) { - LOG_INFO("Would add a string in file {}", filename); - LOG_TRACE("Added: \"{}\"", string); + LOG_INFO("Would add a string in file {}", filename) + LOG_TRACE("Added: \"{}\"", string) return; } @@ -219,7 +219,7 @@ void addStringToFile(std::string_view filename, std::string_view string) fmt::format("Error opening file: {}", filename)); file << string; - LOG_DEBUG("Added line(s):\n{}\n => to file: {}", string, filename); + LOG_DEBUG("Added line(s):\n{}\n => to file: {}", string, filename) } } // namespace cloyster diff --git a/src/main.cpp b/src/main.cpp index d7fc854..6e515a1 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -94,10 +94,10 @@ int main(int argc, const char** argv) }()); #ifndef NDEBUG - LOG_DEBUG("Log level set to: {}\n", cloyster::logLevelInput); + LOG_DEBUG("Log level set to: {}\n", cloyster::logLevelInput) #endif - LOG_INFO("{} Started", productName); + LOG_INFO("{} Started", productName) try { if (cloyster::showVersion) { @@ -123,7 +123,7 @@ int main(int argc, const char** argv) LOG_INFO("Running {}.\n", cloyster::productName) break; } else if (response == 'N' || response == 'n') { - LOG_INFO("Stopping {}.\n", cloyster::productName); + LOG_INFO("Stopping {}.\n", cloyster::productName) return EXIT_SUCCESS; } } @@ -144,7 +144,7 @@ int main(int argc, const char** argv) auto model = std::make_unique(); if (!cloyster::answerfile.empty()) { - LOG_TRACE("Answerfile: {}", cloyster::answerfile); + LOG_TRACE("Answerfile: {}", cloyster::answerfile) model->fillData(cloyster::answerfile); } @@ -159,17 +159,17 @@ int main(int argc, const char** argv) model->printData(); #endif - LOG_TRACE("Starting execution engine"); + LOG_TRACE("Starting execution engine") std::unique_ptr executionEngine = std::make_unique(model); executionEngine->install(); } catch (const std::exception& e) { - LOG_ERROR("ERROR: {}", e.what()); + LOG_ERROR("ERROR: {}", e.what()) return EXIT_FAILURE; } - LOG_INFO("{} has successfully ended", productName); + LOG_INFO("{} has successfully ended", productName) Log::shutdown(); return EXIT_SUCCESS; diff --git a/src/network.cpp b/src/network.cpp index 8d47eb0..5b6b8fe 100644 --- a/src/network.cpp +++ b/src/network.cpp @@ -317,7 +317,7 @@ std::string Network::fetchDomainName() if (getdomainname(domainName, sizeof(domainName)) == -1) throw std::runtime_error("Failed to fetch domain name"); - LOG_TRACE("Got domain name {}", domainName); + LOG_TRACE("Got domain name {}", domainName) return std::string(domainName); } @@ -377,14 +377,14 @@ std::vector
Network::fetchNameservers() nameservers.emplace_back(formattedNs); } - LOG_TRACE("Got nameservers {}", nameservers.data()->to_string()); + LOG_TRACE("Got nameservers {}", nameservers.data()->to_string()) return nameservers; } #ifndef NDEBUG void Network::dumpNetwork() const { - LOG_DEBUG("Profile: {}", magic_enum::enum_name(m_profile)); - LOG_DEBUG("Type: {}", magic_enum::enum_name(m_type)); + LOG_DEBUG("Profile: {}", magic_enum::enum_name(m_profile)) + LOG_DEBUG("Type: {}", magic_enum::enum_name(m_type)) } #endif diff --git a/src/os.cpp b/src/os.cpp index 205018d..4829c60 100644 --- a/src/os.cpp +++ b/src/os.cpp @@ -231,12 +231,12 @@ std::string OS::getValueFromKey(const std::string& line) #ifndef NDEBUG void OS::printData() const { - LOG_DEBUG("Architecture: {}", magic_enum::enum_name(m_arch)); - LOG_DEBUG("Family: {}", magic_enum::enum_name(m_family)); - LOG_DEBUG("Kernel Release: {}", m_kernel); - LOG_DEBUG("Platform: {}", magic_enum::enum_name(m_platform)); - LOG_DEBUG("Distribution: {}", magic_enum::enum_name(m_distro)); - LOG_DEBUG("Major Version: {}", m_majorVersion); - LOG_DEBUG("Minor Version: {}", m_minorVersion); + LOG_DEBUG("Architecture: {}", magic_enum::enum_name(m_arch)) + LOG_DEBUG("Family: {}", magic_enum::enum_name(m_family)) + LOG_DEBUG("Kernel Release: {}", m_kernel) + LOG_DEBUG("Platform: {}", magic_enum::enum_name(m_platform)) + LOG_DEBUG("Distribution: {}", magic_enum::enum_name(m_distro)) + LOG_DEBUG("Major Version: {}", m_majorVersion) + LOG_DEBUG("Minor Version: {}", m_minorVersion) } #endif diff --git a/src/presenter/PresenterGeneralSettings.cpp b/src/presenter/PresenterGeneralSettings.cpp index 327713b..00b8036 100644 --- a/src/presenter/PresenterGeneralSettings.cpp +++ b/src/presenter/PresenterGeneralSettings.cpp @@ -21,13 +21,13 @@ PresenterGeneralSettings::PresenterGeneralSettings( std::size_t i { 0 }; m_model->setName(generalSettings[i++].second); - LOG_DEBUG("Set cluster name: {}", m_model->getName()); + LOG_DEBUG("Set cluster name: {}", m_model->getName()) m_model->setCompanyName(generalSettings[i++].second); - LOG_DEBUG("Set cluster company name: {}", m_model->getCompanyName()); + LOG_DEBUG("Set cluster company name: {}", m_model->getCompanyName()) m_model->setAdminMail(generalSettings[i++].second); - LOG_DEBUG("Set cluster admin e-email: {}", m_model->getAdminMail()); + LOG_DEBUG("Set cluster admin e-email: {}", m_model->getAdminMail()) // Boot target m_model->getHeadnode().setBootTarget( diff --git a/src/presenter/PresenterHostId.cpp b/src/presenter/PresenterHostId.cpp index c0427f6..5ba629f 100644 --- a/src/presenter/PresenterHostId.cpp +++ b/src/presenter/PresenterHostId.cpp @@ -21,12 +21,12 @@ PresenterHostId::PresenterHostId( m_model->getHeadnode().setHostname(answers[0].second); // FIXME: This assert never happens since the setter may throw - // LOG_DEBUG("Returned hostname: {}", answers[0].second); + // LOG_DEBUG("Returned hostname: {}", answers[0].second) // LOG_ASSERT(answers[0].second == m_model->getHeadnode().getHostname(), // "Failed setting hostname"); m_model->setDomainName(answers[1].second); - LOG_DEBUG("Hostname set to: {}", m_model->getHeadnode().getHostname()); - LOG_DEBUG("Domain name set to: {}", m_model->getDomainName()); - LOG_DEBUG("FQDN: {}", m_model->getHeadnode().getFQDN()); + LOG_DEBUG("Hostname set to: {}", m_model->getHeadnode().getHostname()) + LOG_DEBUG("Domain name set to: {}", m_model->getDomainName()) + LOG_DEBUG("FQDN: {}", m_model->getHeadnode().getFQDN()) } diff --git a/src/presenter/PresenterInfiniband.cpp b/src/presenter/PresenterInfiniband.cpp index b065ab7..d0e793b 100644 --- a/src/presenter/PresenterInfiniband.cpp +++ b/src/presenter/PresenterInfiniband.cpp @@ -15,7 +15,7 @@ PresenterInfiniband::PresenterInfiniband( auto interfaces = Connection::fetchInterfaces(); if (std::find(interfaces.begin(), interfaces.end(), "ib0") == interfaces.end()) { - LOG_WARN("No Infiniband interfaces found."); + LOG_WARN("No Infiniband interfaces found.") return; } diff --git a/src/presenter/PresenterInstructions.cpp b/src/presenter/PresenterInstructions.cpp index 7a1cb3d..bc20600 100644 --- a/src/presenter/PresenterInstructions.cpp +++ b/src/presenter/PresenterInstructions.cpp @@ -11,5 +11,5 @@ PresenterInstructions::PresenterInstructions( { m_view->message(Messages::Instructions::message); - LOG_DEBUG("Install instructions displayed"); + LOG_DEBUG("Install instructions displayed") } diff --git a/src/presenter/PresenterMailSystem.cpp b/src/presenter/PresenterMailSystem.cpp index b432af3..41ff866 100644 --- a/src/presenter/PresenterMailSystem.cpp +++ b/src/presenter/PresenterMailSystem.cpp @@ -81,6 +81,6 @@ PresenterMailSystem::PresenterMailSystem( } } else { - LOG_DEBUG("Postfix wasn't enabled"); + LOG_DEBUG("Postfix wasn't enabled") } } diff --git a/src/presenter/PresenterNetwork.cpp b/src/presenter/PresenterNetwork.cpp index 3b9533b..5cf2b8c 100644 --- a/src/presenter/PresenterNetwork.cpp +++ b/src/presenter/PresenterNetwork.cpp @@ -95,9 +95,9 @@ void PresenterNetwork::createNetwork() // Move the data m_model->addNetwork(std::move(m_network)); - LOG_TRACE("Hopefully we have moved m_network to m_model"); + LOG_TRACE("Hopefully we have moved m_network to m_model") m_model->getHeadnode().addConnection(std::move(m_connection)); - LOG_TRACE("Hopefully we have moved m_connection to m_model"); + LOG_TRACE("Hopefully we have moved m_connection to m_model") // Check moved data LOG_DEBUG("Added {} connection on headnode: {} -> {}", diff --git a/src/presenter/PresenterNodesOperationalSystem.cpp b/src/presenter/PresenterNodesOperationalSystem.cpp index 3d33818..4915e84 100644 --- a/src/presenter/PresenterNodesOperationalSystem.cpp +++ b/src/presenter/PresenterNodesOperationalSystem.cpp @@ -73,7 +73,7 @@ PresenterNodesOperationalSystem::PresenterNodesOperationalSystem( fmt::format("wget -NP /root {}", distroDownloadURL)); m_model->setDiskImage(fmt::format("/root/{}", isoName)); - LOG_DEBUG("Selected ISO: {}", fmt::format("/root/{}", isoName)); + LOG_DEBUG("Selected ISO: {}", fmt::format("/root/{}", isoName)) } else { // Operational system directory path selection diff --git a/src/presenter/PresenterTime.cpp b/src/presenter/PresenterTime.cpp index 0ba83bc..0952657 100644 --- a/src/presenter/PresenterTime.cpp +++ b/src/presenter/PresenterTime.cpp @@ -25,7 +25,7 @@ PresenterTime::PresenterTime( std::string_view timezoneArea = m_model->getTimezone().getTimezoneArea(); - LOG_DEBUG("Timezone area set to: {}", timezoneArea); + LOG_DEBUG("Timezone area set to: {}", timezoneArea) // Timezone location selection @@ -44,7 +44,7 @@ PresenterTime::PresenterTime( fmt::format("{}/{}", timezoneArea, selectedTimezoneLocation)); // FIXME: Horrible call; getTimezone() two times? Srsly? - LOG_DEBUG("Timezone set to: {}", m_model->getTimezone().getTimezone()); + LOG_DEBUG("Timezone set to: {}", m_model->getTimezone().getTimezone()) // Timeserver settings // FIXME: We left std::to_array if we want to manage the input on the view, diff --git a/src/presenter/PresenterWelcome.cpp b/src/presenter/PresenterWelcome.cpp index 951dc83..9143318 100644 --- a/src/presenter/PresenterWelcome.cpp +++ b/src/presenter/PresenterWelcome.cpp @@ -11,5 +11,5 @@ PresenterWelcome::PresenterWelcome( { m_view->message(Messages::Welcome::message); - LOG_DEBUG("Welcome message displayed"); + LOG_DEBUG("Welcome message displayed") } diff --git a/src/server.cpp b/src/server.cpp index 9f9cf3a..587ae95 100644 --- a/src/server.cpp +++ b/src/server.cpp @@ -26,7 +26,7 @@ const std::string& Server::getHostname() const noexcept { return m_hostname; } // FIXME: A trigger to update FQDN should be made if hostname is changed void Server::setHostname(const std::string& hostname) { - LOG_DEBUG("Running hostname checks against: {}", hostname); + LOG_DEBUG("Running hostname checks against: {}", hostname) if (hostname.size() > 63) throw std::runtime_error( diff --git a/src/services/shell.cpp b/src/services/shell.cpp index 7e8fe4c..bcd518d 100644 --- a/src/services/shell.cpp +++ b/src/services/shell.cpp @@ -39,12 +39,12 @@ void Shell::disableSELinux() cloyster::backupFile(filename); cloyster::changeValueInConfigurationFile(filename, "SELINUX", "disabled"); - LOG_WARN("SELinux has been disabled"); + LOG_WARN("SELinux has been disabled") } void Shell::configureSELinuxMode() { - LOG_INFO("Setting up SELinux"); + LOG_INFO("Setting up SELinux") switch (m_cluster->getSELinux()) { case Cluster::SELinuxMode::Permissive: @@ -69,7 +69,7 @@ void Shell::configureSELinuxMode() // network exists on the cluster. void Shell::configureFirewall() { - LOG_INFO("Setting up firewall"); + LOG_INFO("Setting up firewall") if (m_cluster->isFirewall()) { runCommand("systemctl enable --now firewalld"); @@ -95,13 +95,13 @@ void Shell::configureFirewall() } else { runCommand("systemctl disable --now firewalld"); - LOG_WARN("Firewalld has been disabled"); + LOG_WARN("Firewalld has been disabled") } } void Shell::configureFQDN() { - LOG_INFO("Setting up hostname"); + LOG_INFO("Setting up hostname") runCommand(fmt::format( "hostnamectl set-hostname {}", m_cluster->getHeadnode().getFQDN())); @@ -110,7 +110,7 @@ void Shell::configureFQDN() // TODO: Proper file parsing void Shell::configureHostsFile() { - LOG_INFO("Setting up additional entries on hosts file"); + LOG_INFO("Setting up additional entries on hosts file") auto& headnode = m_cluster->getHeadnode(); @@ -129,7 +129,7 @@ void Shell::configureHostsFile() void Shell::configureTimezone() { - LOG_INFO("Setting up timezone"); + LOG_INFO("Setting up timezone") runCommand(fmt::format( "timedatectl set-timezone {}", m_cluster->getTimezone().getTimezone())); @@ -137,7 +137,7 @@ void Shell::configureTimezone() void Shell::configureLocale() { - LOG_INFO("Setting up locale"); + LOG_INFO("Setting up locale") runCommand(fmt::format( "localectl set-locale {}", m_cluster->getLocale().getLocale())); @@ -145,7 +145,7 @@ void Shell::configureLocale() void Shell::disableNetworkManagerDNSOverride() { - LOG_INFO("Disabling DNS override on NetworkManager"); + LOG_INFO("Disabling DNS override on NetworkManager") std::string_view filename = CHROOT "/etc/NetworkManager/conf.d/90-dns-none.conf"; @@ -169,7 +169,7 @@ void Shell::disableNetworkManagerDNSOverride() */ void Shell::configureNetworks(const std::list& connections) { - LOG_INFO("Setting up networks"); + LOG_INFO("Setting up networks") runCommand("systemctl enable --now NetworkManager"); @@ -213,14 +213,14 @@ void Shell::configureNetworks(const std::list& connections) void Shell::runSystemUpdate() { if (m_cluster->isUpdateSystem()) { - LOG_INFO("Checking if system updates are available"); + LOG_INFO("Checking if system updates are available") runCommand("dnf -y update"); } } void Shell::installRequiredPackages() { - LOG_INFO("Installing required system packages"); + LOG_INFO("Installing required system packages") runCommand("dnf -y install wget dnf-plugins-core"); } @@ -235,7 +235,7 @@ void Shell::disallowSSHRootPasswordLogin() void Shell::installOpenHPCBase() { - LOG_INFO("Installing base OpenHPC packages"); + LOG_INFO("Installing base OpenHPC packages") runCommand("dnf -y install ohpc-base"); } @@ -273,7 +273,7 @@ void Shell::configureTimeService(const std::list& connections) void Shell::configureQueueSystem() { - LOG_INFO("Setting up the queue system"); + LOG_INFO("Setting up the queue system") if (const auto& queue = m_cluster->getQueueSystem()) { switch (queue.value()->getKind()) { @@ -310,14 +310,14 @@ void Shell::configureQueueSystem() void Shell::configureInfiniband() { if (const auto& ofed = m_cluster->getOFED()) { - LOG_INFO("Setting up Infiniband support"); + LOG_INFO("Setting up Infiniband support") ofed->install(); } } void Shell::removeMemlockLimits() { - LOG_INFO("Removing memlock limits on headnode"); + LOG_INFO("Removing memlock limits on headnode") std::string_view filename = CHROOT "/etc/security/limits.conf"; @@ -395,7 +395,7 @@ void Shell::install() const auto& provisionerName { magic_enum::enum_name( m_cluster->getProvisioner()) }; - LOG_DEBUG("Setting up the provisioner: {}", provisionerName); + LOG_DEBUG("Setting up the provisioner: {}", provisionerName) // std::unique_ptr provisioner; std::unique_ptr provisioner; switch (m_cluster->getProvisioner()) { @@ -404,21 +404,21 @@ void Shell::install() break; } - LOG_INFO("Setting up compute node images... This may take a while"); + LOG_INFO("Setting up compute node images... This may take a while") - LOG_INFO("[{}] Installing packages", provisionerName); + LOG_INFO("[{}] Installing packages", provisionerName) provisioner->installPackages(); - LOG_INFO("[{}] Setting up the provisioner", provisionerName); + LOG_INFO("[{}] Setting up the provisioner", provisionerName) provisioner->setup(); - LOG_INFO("[{}] Creating node images", provisionerName); + LOG_INFO("[{}] Creating node images", provisionerName) provisioner->createImage(); - LOG_INFO("[{}] Adding compute nodes", provisionerName); + LOG_INFO("[{}] Adding compute nodes", provisionerName) provisioner->addNodes(); - LOG_INFO("[{}] Setting up image on nodes", provisionerName); + LOG_INFO("[{}] Setting up image on nodes", provisionerName) provisioner->setNodesImage(); LOG_INFO("[{}] Setting up boot settings via IPMI, if available", diff --git a/src/services/timezone.cpp b/src/services/timezone.cpp index 870d3e3..6a7465a 100644 --- a/src/services/timezone.cpp +++ b/src/services/timezone.cpp @@ -26,7 +26,7 @@ std::string_view Timezone::getTimezoneArea() const { return m_timezoneArea; } void Timezone::setSystemTimezone() { - LOG_DEBUG("Setting system timezone to {}\n", m_timezone); + LOG_DEBUG("Setting system timezone to {}\n", m_timezone) cloyster::runCommand( fmt::format("timedatectl set timezone {}", m_timezone)); } @@ -38,7 +38,7 @@ std::multimap Timezone::getAvailableTimezones() const std::multimap Timezone::fetchAvailableTimezones() { - LOG_DEBUG("Fetching available system timezones"); + LOG_DEBUG("Fetching available system timezones") std::list output; // TODO: Remove this hack diff --git a/src/services/xcat.cpp b/src/services/xcat.cpp index 5ac430d..32655fc 100644 --- a/src/services/xcat.cpp +++ b/src/services/xcat.cpp @@ -77,7 +77,7 @@ void XCAT::nodeset(std::string_view nodes) void XCAT::createDirectoryTree() { if (cloyster::dryRun) { - LOG_INFO("Would create the directory CHROOT/install/custom/netboot"); + LOG_INFO("Would create the directory CHROOT/install/custom/netboot") return; } @@ -202,7 +202,7 @@ void XCAT::generatePostinstallFile() } if (cloyster::dryRun) { - LOG_INFO("Would change file {} permissions", filename); + LOG_INFO("Would change file {} permissions", filename) return; } @@ -363,7 +363,7 @@ void XCAT::createImage(ImageType imageType, NodeType nodeType) void XCAT::addNode(const Node& node) { - LOG_DEBUG("Adding node {} to xCAT", node.getHostname()); + LOG_DEBUG("Adding node {} to xCAT", node.getHostname()) std::string command = fmt::format( "mkdef -f -t node {} arch={} ip={} mac={} groups=compute,all " diff --git a/src/view/newt.cpp b/src/view/newt.cpp index 65a7c8f..97873e0 100644 --- a/src/view/newt.cpp +++ b/src/view/newt.cpp @@ -49,7 +49,7 @@ void Newt::abort() { // TODO: We should only destroy the view and not terminate the application this->~Newt(); - LOG_WARN("{}", TUIText::abort); + LOG_WARN("{}", TUIText::abort) std::exit(EXIT_SUCCESS); }