From: Jean-Marcel Flach Date: Mon, 20 Apr 2015 09:01:27 +0000 (+0200) Subject: Refactor code X-Git-Tag: v2.4.0~716 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=9ae8a09b7e92768370885ce7d4a6147a1d469f1c;p=icinga2 Refactor code fixes #9112 --- diff --git a/lib/cli/troubleshootcommand.cpp b/lib/cli/troubleshootcommand.cpp index 8b4d91eec..8e63904d5 100644 --- a/lib/cli/troubleshootcommand.cpp +++ b/lib/cli/troubleshootcommand.cpp @@ -253,14 +253,14 @@ bool TroubleshootCommand::ConfigInfo(InfoLog& log, const boost::program_options: InfoLogLine(log) << "A collection of important configuration files follows, please make sure to remove any sensitive data such as credentials, internal company names, etc\n"; - if (!PrintConf(log, Application::GetSysconfDir() + "/icinga2/icinga2.conf")) { + if (!PrintFile(log, Application::GetSysconfDir() + "/icinga2/icinga2.conf")) { InfoLogLine(log, 0, LogWarning) << "icinga2.conf not found, therefore skipping validation.\n" << "If you are using an icinga2.conf somewhere but the default path please validate it via 'icinga2 daemon -C -c \"path\to/icinga2.conf\"'\n" << "and provide it with your support request.\n"; } - if (!PrintConf(log, Application::GetSysconfDir() + "/icinga2/zones.conf")) { + if (!PrintFile(log, Application::GetSysconfDir() + "/icinga2/zones.conf")) { InfoLogLine(log, 0, LogWarning) << "zones.conf not found.\n" << "If you are using a zones.conf somewhere but the default path please provide it with your support request\n"; @@ -410,7 +410,7 @@ bool TroubleshootCommand::PrintCrashReports(InfoLog& log) InfoLogLine(log) << "Latest crash report is from " << Utility::FormatDateTime("%Y-%m-%d %H:%M:%S", Utility::GetTime()) << '\n' << "File: " << bestFilename << "\n\n"; - PrintConf(log, bestFilename); + PrintFile(log, bestFilename); InfoLogLine(log) << '\n'; } @@ -418,7 +418,7 @@ bool TroubleshootCommand::PrintCrashReports(InfoLog& log) return true; } -bool TroubleshootCommand::PrintConf(InfoLog& log, const String& path) +bool TroubleshootCommand::PrintFile(InfoLog& log, const String& path) { std::ifstream text; text.open(path.CStr(), std::ifstream::in); diff --git a/lib/cli/troubleshootcommand.hpp b/lib/cli/troubleshootcommand.hpp index b336baffe..d1cb1c7b1 100644 --- a/lib/cli/troubleshootcommand.hpp +++ b/lib/cli/troubleshootcommand.hpp @@ -58,7 +58,7 @@ private: static bool CheckFeatures(InfoLog& log); static void GetLatestReport(const String& filename, time_t& bestTimestamp, String& bestFilename); static bool PrintCrashReports(InfoLog& log); - static bool PrintConf(InfoLog& log, const String& path); + static bool PrintFile(InfoLog& log, const String& path); static bool CheckConfig(void); static void CheckObjectFile(const String& objectfile, InfoLog& log, InfoLog *OFile, const bool objectConsole, Dictionary::Ptr& logs, std::set& configs);