mirror of https://github.com/Icinga/icinga2.git
Prevent object deletion on shutdown when checking !IsActive()
This is fairly ugly and sets an extension for the ConfigObjectUtility delete handler to signal the OnActiveChanged handler inside the cluster configsync to send a delete event to the other nodes. refs #9927
This commit is contained in:
parent
4955c28b0c
commit
0fd9d3406b
|
@ -53,7 +53,7 @@ void ApiListener::ConfigUpdateObjectHandler(const ConfigObject::Ptr& object, con
|
|||
if (object->IsActive()) {
|
||||
/* Sync object config */
|
||||
listener->UpdateConfigObject(object, cookie);
|
||||
} else {
|
||||
} else if (!object->IsActive() && object->GetExtension("ConfigObjectDeleted")) {
|
||||
/* Delete object */
|
||||
listener->DeleteConfigObject(object, cookie);
|
||||
}
|
||||
|
|
|
@ -154,6 +154,9 @@ bool ConfigObjectUtility::DeleteObjectHelper(const ConfigObject::Ptr& object, bo
|
|||
ConfigItem::Ptr item = ConfigItem::GetByTypeAndName(type->GetName(), object->GetName());
|
||||
|
||||
try {
|
||||
/* mark this object for cluster delete event */
|
||||
object->SetExtension("ConfigObjectDeleted", true);
|
||||
/* triggers signal for DB IDO and other interfaces */
|
||||
object->Deactivate();
|
||||
|
||||
if (item)
|
||||
|
|
Loading…
Reference in New Issue