mirror of
https://github.com/Icinga/icinga2.git
synced 2025-07-26 23:24:09 +02:00
Improve logging for staged config sync
This commit is contained in:
parent
1853254201
commit
e545884952
@ -126,12 +126,15 @@ bool DaemonUtility::ValidateConfigFiles(const std::vector<std::string>& configs,
|
|||||||
* unfortunately moving it there is somewhat non-trivial. */
|
* unfortunately moving it there is somewhat non-trivial. */
|
||||||
success = true;
|
success = true;
|
||||||
|
|
||||||
String zonesEtcDir = Configuration::ZonesDir;
|
/* Only load zone directory if we're not in staging validation. */
|
||||||
if (!zonesEtcDir.IsEmpty() && Utility::PathExists(zonesEtcDir))
|
if (!systemNS->Contains("ZonesStageVarDir")) {
|
||||||
Utility::Glob(zonesEtcDir + "/*", std::bind(&IncludeZoneDirRecursive, _1, "_etc", std::ref(success)), GlobDirectory);
|
String zonesEtcDir = Configuration::ZonesDir;
|
||||||
|
if (!zonesEtcDir.IsEmpty() && Utility::PathExists(zonesEtcDir))
|
||||||
|
Utility::Glob(zonesEtcDir + "/*", std::bind(&IncludeZoneDirRecursive, _1, "_etc", std::ref(success)), GlobDirectory);
|
||||||
|
|
||||||
if (!success)
|
if (!success)
|
||||||
return false;
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
/* Load package config files - they may contain additional zones which
|
/* Load package config files - they may contain additional zones which
|
||||||
* are authoritative on this node and are checked in HasZoneConfigAuthority(). */
|
* are authoritative on this node and are checked in HasZoneConfigAuthority(). */
|
||||||
@ -148,6 +151,9 @@ bool DaemonUtility::ValidateConfigFiles(const std::vector<std::string>& configs,
|
|||||||
/* Cluster config sync stage validation needs this. */
|
/* Cluster config sync stage validation needs this. */
|
||||||
if (systemNS->Contains("ZonesStageVarDir")) {
|
if (systemNS->Contains("ZonesStageVarDir")) {
|
||||||
zonesVarDir = systemNS->Get("ZonesStageVarDir");
|
zonesVarDir = systemNS->Get("ZonesStageVarDir");
|
||||||
|
|
||||||
|
Log(LogDebug, "DaemonUtility")
|
||||||
|
<< "Overriding zones var directory with '" << zonesVarDir << "' for cluster config sync staging.";
|
||||||
}
|
}
|
||||||
|
|
||||||
if (Utility::PathExists(zonesVarDir))
|
if (Utility::PathExists(zonesVarDir))
|
||||||
|
@ -364,6 +364,9 @@ void ApiListener::TryActivateZonesStageCallback(const ProcessResult& pr,
|
|||||||
|
|
||||||
/* validation went fine, copy stage and reload */
|
/* validation went fine, copy stage and reload */
|
||||||
if (pr.ExitStatus == 0) {
|
if (pr.ExitStatus == 0) {
|
||||||
|
Log(LogInformation, "ApiListener")
|
||||||
|
<< "Config validation for stage '" << GetApiZonesStageDir() << "' was OK, triggering reload.";
|
||||||
|
|
||||||
for (const String& path : relativePaths) {
|
for (const String& path : relativePaths) {
|
||||||
/* TODO: Better error handling with existing files. */
|
/* TODO: Better error handling with existing files. */
|
||||||
Log(LogCritical, "ApiListener")
|
Log(LogCritical, "ApiListener")
|
||||||
@ -381,7 +384,8 @@ void ApiListener::TryActivateZonesStageCallback(const ProcessResult& pr,
|
|||||||
Application::RequestRestart();
|
Application::RequestRestart();
|
||||||
} else {
|
} else {
|
||||||
Log(LogCritical, "ApiListener")
|
Log(LogCritical, "ApiListener")
|
||||||
<< "Config validation failed for staged cluster config sync. Stage not put in production, aborting.";
|
<< "Config validation failed for staged cluster config sync. Aborting. Logs: '"
|
||||||
|
<< GetApiZonesStageDir() + "/startup.log'";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user