mirror of https://github.com/Icinga/icinga2.git
Fix problem with non-existing objects in config sync updates
refs #9851 refs #9927 refs #9081
This commit is contained in:
parent
eb2d4f2184
commit
19e7524b31
|
@ -138,9 +138,20 @@ Value ApiListener::ConfigUpdateObjectAPIHandler(const MessageOrigin::Ptr& origin
|
|||
object->SetVersion(objVersion, false, origin);
|
||||
}
|
||||
|
||||
if (!object)
|
||||
return Empty;
|
||||
|
||||
/* update object attributes if version was changed */
|
||||
if (object && objVersion > object->GetVersion()) {
|
||||
Log(LogInformation, "ApiListener")
|
||||
if (objVersion <= object->GetVersion()) {
|
||||
Log(LogNotice, "ApiListener")
|
||||
<< "Discarding config update for object '" << object->GetName()
|
||||
<< "': Object version " << object->GetVersion()
|
||||
<< " is more recent than the received version " << objVersion << ".";
|
||||
|
||||
return Empty;
|
||||
}
|
||||
|
||||
Log(LogNotice, "ApiListener")
|
||||
<< "Processing config update for object '" << object->GetName()
|
||||
<< "': Object version " << object->GetVersion()
|
||||
<< " is older than the received version " << objVersion << ".";
|
||||
|
@ -160,13 +171,6 @@ Value ApiListener::ConfigUpdateObjectAPIHandler(const MessageOrigin::Ptr& origin
|
|||
|
||||
/* keep the object version in sync with the sender */
|
||||
object->SetVersion(objVersion, false, origin);
|
||||
} else {
|
||||
Log(LogNotice, "ApiListener")
|
||||
<< "Discarding config update for object '" << object->GetName()
|
||||
<< "': Object version " << object->GetVersion()
|
||||
<< " is more recent than the received version " << objVersion << ".";
|
||||
return Empty;
|
||||
}
|
||||
|
||||
return Empty;
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue