mirror of
https://github.com/Icinga/icinga2.git
synced 2025-07-28 16:14:09 +02:00
Update log message and implement recursive diff delete
This commit is contained in:
parent
2acf3a6941
commit
604a8a041d
@ -132,23 +132,24 @@ bool ApiListener::UpdateConfigDir(const ConfigDirInformation& oldConfigInfo, con
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Update with staging information TODO - use `authoritative` as flag. */
|
/* Log something whether we're authoritative or receing a staged config. */
|
||||||
Log(LogInformation, "ApiListener")
|
Log(LogInformation, "ApiListener")
|
||||||
<< "Applying configuration file update for path '" << configDir << "' (" << numBytes << " Bytes). Received timestamp '"
|
<< "Applying configuration file update for " << (authoritative ? "" : "stage ")
|
||||||
|
<< "path '" << configDir << "' (" << numBytes << " Bytes). Received timestamp '"
|
||||||
<< Utility::FormatDateTime("%Y-%m-%d %H:%M:%S %z", newTimestamp) << "' ("
|
<< Utility::FormatDateTime("%Y-%m-%d %H:%M:%S %z", newTimestamp) << "' ("
|
||||||
<< std::fixed << std::setprecision(6) << newTimestamp
|
<< std::fixed << std::setprecision(6) << newTimestamp
|
||||||
<< "), Current timestamp '"
|
<< "), Current timestamp '"
|
||||||
<< Utility::FormatDateTime("%Y-%m-%d %H:%M:%S %z", oldTimestamp) << "' ("
|
<< Utility::FormatDateTime("%Y-%m-%d %H:%M:%S %z", oldTimestamp) << "' ("
|
||||||
<< oldTimestamp << ").";
|
<< oldTimestamp << ").";
|
||||||
|
|
||||||
/* TODO: Deal with recursive directories. */
|
/* If the update removes a path, delete it on disk. */
|
||||||
ObjectLock xlock(oldConfig);
|
ObjectLock xlock(oldConfig);
|
||||||
for (const Dictionary::Pair& kv : oldConfig) {
|
for (const Dictionary::Pair& kv : oldConfig) {
|
||||||
if (!newConfig->Contains(kv.first)) {
|
if (!newConfig->Contains(kv.first)) {
|
||||||
configChange = true;
|
configChange = true;
|
||||||
|
|
||||||
String path = configDir + "/" + kv.first;
|
String path = configDir + "/" + kv.first;
|
||||||
(void) unlink(path.CStr());
|
Utility::RemoveDirRecursive(path);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user