mirror of
https://github.com/Icinga/icinga2.git
synced 2025-04-08 17:05:25 +02:00
Config sync: Only remove files, if timestamp changed
This commit is contained in:
parent
d80eb89908
commit
f184c1bc57
@ -421,6 +421,12 @@ void ApiListener::HandleConfigUpdate(const MessageOrigin::Ptr& origin, const Dic
|
||||
Dictionary::Ptr productionConfig = MergeConfigUpdate(productionConfigInfo);
|
||||
Dictionary::Ptr newConfig = MergeConfigUpdate(newConfigInfo);
|
||||
|
||||
bool timestampChanged = false;
|
||||
|
||||
if (CompareTimestampsConfigChange(productionConfig, newConfig, stageConfigZoneDir)) {
|
||||
timestampChanged = true;
|
||||
}
|
||||
|
||||
/* If we have received 'checksums' via cluster message, go for it.
|
||||
* Otherwise do the old timestamp dance for versions < 2.11.
|
||||
*/
|
||||
@ -429,7 +435,7 @@ void ApiListener::HandleConfigUpdate(const MessageOrigin::Ptr& origin, const Dic
|
||||
<< "Received configuration for zone '" << zoneName << "' from endpoint '"
|
||||
<< fromEndpointName << "'. Comparing the timestamp and checksums.";
|
||||
|
||||
if (CompareTimestampsConfigChange(productionConfig, newConfig, stageConfigZoneDir)) {
|
||||
if (timestampChanged) {
|
||||
|
||||
if (CheckConfigChange(productionConfigInfo, newConfigInfo))
|
||||
configChange = true;
|
||||
@ -446,7 +452,7 @@ void ApiListener::HandleConfigUpdate(const MessageOrigin::Ptr& origin, const Dic
|
||||
<< "Received configuration update without checksums from parent endpoint "
|
||||
<< fromEndpointName << ". This behaviour is deprecated. Please upgrade the parent endpoint to 2.11+";
|
||||
|
||||
if (CompareTimestampsConfigChange(productionConfig, newConfig, stageConfigZoneDir)) {
|
||||
if (timestampChanged) {
|
||||
configChange = true;
|
||||
}
|
||||
|
||||
@ -508,8 +514,8 @@ void ApiListener::HandleConfigUpdate(const MessageOrigin::Ptr& origin, const Dic
|
||||
<< "Applying configuration file update for path '" << stageConfigZoneDir << "' ("
|
||||
<< numBytes << " Bytes).";
|
||||
|
||||
// If the update removes a path, delete it on disk and signal a config change.
|
||||
{
|
||||
if (timestampChanged) {
|
||||
// If the update removes a path, delete it on disk and signal a config change.
|
||||
ObjectLock xlock(productionConfig);
|
||||
|
||||
for (const Dictionary::Pair& kv : productionConfig) {
|
||||
|
Loading…
x
Reference in New Issue
Block a user