mirror of
https://github.com/Icinga/icinga2.git
synced 2025-07-29 16:44:29 +02:00
Fix style and comments
This commit is contained in:
parent
5fbc052aba
commit
eff6e7662c
@ -667,7 +667,6 @@ bool ApiListener::CheckConfigChange(const ConfigDirInformation& oldConfig, const
|
|||||||
<< "' vs. new (" << newChecksums->GetLength() << "): '"
|
<< "' vs. new (" << newChecksums->GetLength() << "): '"
|
||||||
<< JsonEncode(newChecksums) << "'.";
|
<< JsonEncode(newChecksums) << "'.";
|
||||||
|
|
||||||
|
|
||||||
/* Since internal files are synced here too, we can not depend on length.
|
/* Since internal files are synced here too, we can not depend on length.
|
||||||
* So we need to go through both checksum sets to cover the cases"everything is new" and "everything was deleted".
|
* So we need to go through both checksum sets to cover the cases"everything is new" and "everything was deleted".
|
||||||
*/
|
*/
|
||||||
@ -677,36 +676,36 @@ bool ApiListener::CheckConfigChange(const ConfigDirInformation& oldConfig, const
|
|||||||
String path = kv.first;
|
String path = kv.first;
|
||||||
String oldChecksum = kv.second;
|
String oldChecksum = kv.second;
|
||||||
|
|
||||||
// TODO: Figure out if config changes only apply to '.conf'. Leaving this open for other config files.
|
|
||||||
//if (!Utility::Match("*.conf", path))
|
|
||||||
// continue;
|
|
||||||
|
|
||||||
/* Ignore internal files, especially .timestamp and .checksums.
|
/* Ignore internal files, especially .timestamp and .checksums.
|
||||||
*
|
*
|
||||||
* If we don't, this results in "always change" restart loops.
|
* If we don't, this results in "always change" restart loops.
|
||||||
*/
|
*/
|
||||||
if (Utility::Match("/.*", path)) {
|
if (Utility::Match("/.*", path)) {
|
||||||
Log(LogDebug, "ApiListener")
|
Log(LogDebug, "ApiListener")
|
||||||
<< "Ignoring old internal file '" << path << "'.";
|
<< "Ignoring old internal file '" << path << "'.";
|
||||||
|
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
Log(LogDebug, "ApiListener")
|
Log(LogDebug, "ApiListener")
|
||||||
<< "Checking " << path << " for old checksum: " << oldChecksum << ".";
|
<< "Checking " << path << " for old checksum: " << oldChecksum << ".";
|
||||||
|
|
||||||
// Check if key exists first for more verbose logging.
|
// Check if key exists first for more verbose logging.
|
||||||
// TODO: Don't do this later on.
|
// Note: Don't do this later on.
|
||||||
if (!newChecksums->Contains(path)) {
|
if (!newChecksums->Contains(path)) {
|
||||||
Log(LogDebug, "ApiListener")
|
Log(LogDebug, "ApiListener")
|
||||||
<< "File '" << path << "' was deleted by remote.";
|
<< "File '" << path << "' was deleted by remote.";
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
String newChecksum = newChecksums->Get(path);
|
String newChecksum = newChecksums->Get(path);
|
||||||
|
|
||||||
if (newChecksum != kv.second) {
|
if (newChecksum != kv.second) {
|
||||||
Log(LogDebug, "ApiListener")
|
Log(LogDebug, "ApiListener")
|
||||||
<< "Path '" << path << "' doesn't match old checksum '"
|
<< "Path '" << path << "' doesn't match old checksum '"
|
||||||
<< oldChecksum << "' with new checksum '" << newChecksum << "'.";
|
<< oldChecksum << "' with new checksum '" << newChecksum << "'.";
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -718,27 +717,25 @@ bool ApiListener::CheckConfigChange(const ConfigDirInformation& oldConfig, const
|
|||||||
String path = kv.first;
|
String path = kv.first;
|
||||||
String newChecksum = kv.second;
|
String newChecksum = kv.second;
|
||||||
|
|
||||||
// TODO: Figure out if config changes only apply to '.conf'. Leaving this open for other config files.
|
|
||||||
//if (!Utility::Match("*.conf", path))
|
|
||||||
// continue;
|
|
||||||
|
|
||||||
/* Ignore internal files, especially .timestamp and .checksums.
|
/* Ignore internal files, especially .timestamp and .checksums.
|
||||||
*
|
*
|
||||||
* If we don't, this results in "always change" restart loops.
|
* If we don't, this results in "always change" restart loops.
|
||||||
*/
|
*/
|
||||||
if (Utility::Match("/.*", path)) {
|
if (Utility::Match("/.*", path)) {
|
||||||
Log(LogDebug, "ApiListener")
|
Log(LogDebug, "ApiListener")
|
||||||
<< "Ignoring new internal file '" << path << "'.";
|
<< "Ignoring new internal file '" << path << "'.";
|
||||||
|
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
Log(LogDebug, "ApiListener")
|
Log(LogDebug, "ApiListener")
|
||||||
<< "Checking " << path << " for new checksum: " << newChecksum << ".";
|
<< "Checking " << path << " for new checksum: " << newChecksum << ".";
|
||||||
|
|
||||||
// Here we only need to check if the checksum exists, checksums in both sets have already been compared
|
// Check if the checksum exists, checksums in both sets have already been compared
|
||||||
if (!oldChecksums->Contains(path)) {
|
if (!oldChecksums->Contains(path)) {
|
||||||
Log(LogDebug, "ApiListener")
|
Log(LogDebug, "ApiListener")
|
||||||
<< "File '" << path << "' was added by remote.";
|
<< "File '" << path << "' was added by remote.";
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user