mirror of https://github.com/Icinga/icinga2.git
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. */
|
||||
success = true;
|
||||
|
||||
String zonesEtcDir = Configuration::ZonesDir;
|
||||
if (!zonesEtcDir.IsEmpty() && Utility::PathExists(zonesEtcDir))
|
||||
Utility::Glob(zonesEtcDir + "/*", std::bind(&IncludeZoneDirRecursive, _1, "_etc", std::ref(success)), GlobDirectory);
|
||||
/* Only load zone directory if we're not in staging validation. */
|
||||
if (!systemNS->Contains("ZonesStageVarDir")) {
|
||||
String zonesEtcDir = Configuration::ZonesDir;
|
||||
if (!zonesEtcDir.IsEmpty() && Utility::PathExists(zonesEtcDir))
|
||||
Utility::Glob(zonesEtcDir + "/*", std::bind(&IncludeZoneDirRecursive, _1, "_etc", std::ref(success)), GlobDirectory);
|
||||
|
||||
if (!success)
|
||||
return false;
|
||||
if (!success)
|
||||
return false;
|
||||
}
|
||||
|
||||
/* Load package config files - they may contain additional zones which
|
||||
* 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. */
|
||||
if (systemNS->Contains("ZonesStageVarDir")) {
|
||||
zonesVarDir = systemNS->Get("ZonesStageVarDir");
|
||||
|
||||
Log(LogDebug, "DaemonUtility")
|
||||
<< "Overriding zones var directory with '" << zonesVarDir << "' for cluster config sync staging.";
|
||||
}
|
||||
|
||||
if (Utility::PathExists(zonesVarDir))
|
||||
|
|
|
@ -364,6 +364,9 @@ void ApiListener::TryActivateZonesStageCallback(const ProcessResult& pr,
|
|||
|
||||
/* validation went fine, copy stage and reload */
|
||||
if (pr.ExitStatus == 0) {
|
||||
Log(LogInformation, "ApiListener")
|
||||
<< "Config validation for stage '" << GetApiZonesStageDir() << "' was OK, triggering reload.";
|
||||
|
||||
for (const String& path : relativePaths) {
|
||||
/* TODO: Better error handling with existing files. */
|
||||
Log(LogCritical, "ApiListener")
|
||||
|
@ -381,7 +384,8 @@ void ApiListener::TryActivateZonesStageCallback(const ProcessResult& pr,
|
|||
Application::RequestRestart();
|
||||
} else {
|
||||
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…
Reference in New Issue