mirror of
https://github.com/Icinga/icinga2.git
synced 2025-07-26 23:24:09 +02:00
Refine log messages and code comments
This commit is contained in:
parent
e529d5e285
commit
81faf9b7c3
@ -101,10 +101,12 @@ static void HandleLegacyDefines()
|
|||||||
#endif /* _WIN32 */
|
#endif /* _WIN32 */
|
||||||
|
|
||||||
Value localStateDir = Application::GetConst("LocalStateDir");
|
Value localStateDir = Application::GetConst("LocalStateDir");
|
||||||
|
|
||||||
if (!localStateDir.IsEmpty()) {
|
if (!localStateDir.IsEmpty()) {
|
||||||
Log(LogWarning, "icinga-app")
|
Log(LogWarning, "icinga-app")
|
||||||
<< "Please do not set LocalStateDir anymore, set DataDir, LogDir, CacheDir and SpoolDir!"
|
<< "Please do not set the deprecated 'LocalStateDir' constant,"
|
||||||
<< " Resetting those vars based on LocalStateDir!";
|
<< " use the 'DataDir', 'LogDir', 'CacheDir' and 'SpoolDir' constants instead!"
|
||||||
|
<< " For compatibility reasons, these are now set based on the 'LocalStateDir' constant.";
|
||||||
|
|
||||||
#ifdef _WIN32
|
#ifdef _WIN32
|
||||||
ScriptGlobal::Set("DataDir", localStateDir + "\\lib\\icinga2");
|
ScriptGlobal::Set("DataDir", localStateDir + "\\lib\\icinga2");
|
||||||
@ -126,7 +128,7 @@ static void HandleLegacyDefines()
|
|||||||
Value sysconfDir = Application::GetConst("SysconfDir");
|
Value sysconfDir = Application::GetConst("SysconfDir");
|
||||||
if (!sysconfDir.IsEmpty()) {
|
if (!sysconfDir.IsEmpty()) {
|
||||||
Log(LogWarning, "icinga-app")
|
Log(LogWarning, "icinga-app")
|
||||||
<< "Please do not set Sysconfdir anymore, set ConfigDir! Resetting the var based on SysconfDir!";
|
<< "Please do not set the deprecated 'Sysconfdir' constant, use the 'ConfigDir' constant instead! For compatibility reasons, their value is set based on the 'SysconfDir' constant.";
|
||||||
|
|
||||||
#ifdef _WIN32
|
#ifdef _WIN32
|
||||||
ScriptGlobal::Set("ConfigDir", sysconfDir + "\\icinga2");
|
ScriptGlobal::Set("ConfigDir", sysconfDir + "\\icinga2");
|
||||||
@ -142,7 +144,7 @@ static void HandleLegacyDefines()
|
|||||||
Value runDir = Application::GetConst("RunDir");
|
Value runDir = Application::GetConst("RunDir");
|
||||||
if (!runDir.IsEmpty()) {
|
if (!runDir.IsEmpty()) {
|
||||||
Log(LogWarning, "icinga-app")
|
Log(LogWarning, "icinga-app")
|
||||||
<< "Please do not set RunDir anymore, set InitRunDir! Resetting the var based on RunDir!";
|
<< "Please do not set the deprecated 'RunDir' constant, use the 'InitRunDir' constant instead! For compatiblity reasons, their value is set based on the 'RunDir' constant.";
|
||||||
|
|
||||||
#ifdef _WIN32
|
#ifdef _WIN32
|
||||||
ScriptGlobal::Set("InitRunDir", runDir + "\\icinga2");
|
ScriptGlobal::Set("InitRunDir", runDir + "\\icinga2");
|
||||||
@ -190,9 +192,9 @@ static int Main()
|
|||||||
#ifdef _WIN32
|
#ifdef _WIN32
|
||||||
bool builtinPaths = true;
|
bool builtinPaths = true;
|
||||||
|
|
||||||
// Programm install location, C:/Program Files/Icinga2
|
/* Programm install location, C:/Program Files/Icinga2 */
|
||||||
String binaryPrefix = Utility::GetIcingaInstallPath();
|
String binaryPrefix = Utility::GetIcingaInstallPath();
|
||||||
// Returns the datapath for daemons, %PROGRAMDATA%/icinga2
|
/* Returns the datapath for daemons, %PROGRAMDATA%/icinga2 */
|
||||||
String dataPrefix = Utility::GetIcingaDataPath();
|
String dataPrefix = Utility::GetIcingaDataPath();
|
||||||
|
|
||||||
if (!binaryPrefix.IsEmpty() && !dataPrefix.IsEmpty()) {
|
if (!binaryPrefix.IsEmpty() && !dataPrefix.IsEmpty()) {
|
||||||
@ -206,9 +208,7 @@ static int Main()
|
|||||||
Application::DeclareConst("CacheDir", dataPrefix + "\\var\\cache\\icinga2");
|
Application::DeclareConst("CacheDir", dataPrefix + "\\var\\cache\\icinga2");
|
||||||
Application::DeclareConst("SpoolDir", dataPrefix + "\\var\\spool\\icinga2");
|
Application::DeclareConst("SpoolDir", dataPrefix + "\\var\\spool\\icinga2");
|
||||||
|
|
||||||
// also see call to HandleLegacyDefines() later
|
/* Internal constants. */
|
||||||
|
|
||||||
// internal constants
|
|
||||||
Application::DeclareConst("PkgDataDir", binaryPrefix + "\\share\\icinga2");
|
Application::DeclareConst("PkgDataDir", binaryPrefix + "\\share\\icinga2");
|
||||||
Application::DeclareConst("IncludeConfDir", binaryPrefix + "\\share\\icinga2\\include");
|
Application::DeclareConst("IncludeConfDir", binaryPrefix + "\\share\\icinga2\\include");
|
||||||
} else {
|
} else {
|
||||||
@ -224,9 +224,7 @@ static int Main()
|
|||||||
|
|
||||||
Application::DeclareConst("PrefixDir", ICINGA_PREFIX);
|
Application::DeclareConst("PrefixDir", ICINGA_PREFIX);
|
||||||
|
|
||||||
// also see call to HandleLegacyDefines() later
|
/* Internal constants. */
|
||||||
|
|
||||||
// internal constants
|
|
||||||
Application::DeclareConst("PkgDataDir", ICINGA_PKGDATADIR);
|
Application::DeclareConst("PkgDataDir", ICINGA_PKGDATADIR);
|
||||||
Application::DeclareConst("IncludeConfDir", ICINGA_INCLUDECONFDIR);
|
Application::DeclareConst("IncludeConfDir", ICINGA_INCLUDECONFDIR);
|
||||||
|
|
||||||
@ -361,8 +359,7 @@ static int Main()
|
|||||||
GetUserName(username, &usernameLen);
|
GetUserName(username, &usernameLen);
|
||||||
|
|
||||||
std::ifstream userFile;
|
std::ifstream userFile;
|
||||||
String configDir = Application::GetConst("ConfigDir");
|
userFile.open(Application::GetConst("ConfigDir") + "/user");
|
||||||
userFile.open(configDir + "/user");
|
|
||||||
|
|
||||||
if (userFile && command && !Application::IsProcessElevated()) {
|
if (userFile && command && !Application::IsProcessElevated()) {
|
||||||
std::string userLine;
|
std::string userLine;
|
||||||
@ -446,6 +443,7 @@ static int Main()
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* Ensure that all defined constants work in the way we expect them. */
|
||||||
HandleLegacyDefines();
|
HandleLegacyDefines();
|
||||||
|
|
||||||
if (vm.count("script-debugger"))
|
if (vm.count("script-debugger"))
|
||||||
|
Loading…
x
Reference in New Issue
Block a user