From: Gunnar Beutner Date: Thu, 29 Aug 2013 17:25:34 +0000 (+0200) Subject: Another bugfix for the event order. X-Git-Tag: v0.0.3~648 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=c9ec28440e80d400bb9fd22f63d4740304b94e46;p=icinga2 Another bugfix for the event order. --- diff --git a/lib/base/dynamicobject.cpp b/lib/base/dynamicobject.cpp index 683d0fde5..ba8828788 100644 --- a/lib/base/dynamicobject.cpp +++ b/lib/base/dynamicobject.cpp @@ -292,6 +292,7 @@ void DynamicObject::RestoreObjects(const String& filename, int attributeTypes) ASSERT(!object->IsActive()); Log(LogDebug, "base", "Restoring object '" + name + "' of type '" + type + "'."); object->Deserialize(update, attributeTypes); + object->OnStateLoaded(); } restored++; diff --git a/lib/config/configitem.cpp b/lib/config/configitem.cpp index 94b7e4015..cfba85cc7 100644 --- a/lib/config/configitem.cpp +++ b/lib/config/configitem.cpp @@ -282,15 +282,16 @@ void ConfigItem::ActivateItems(void) /* restore the previous program state */ DynamicObject::RestoreObjects(Application::GetStatePath()); - BOOST_FOREACH(const DynamicObject::Ptr& object, objects) { - object->OnStateLoaded(); - } + BOOST_FOREACH(const DynamicType::Ptr& type, DynamicType::GetTypes()) { + BOOST_FOREACH(const DynamicObject::Ptr& object, type->GetObjects()) { + if (object->IsActive()) + continue; - BOOST_FOREACH(const DynamicObject::Ptr& object, objects) { - Log(LogDebug, "config", "Activating object '" + object->GetName() + "' of type '" + object->GetType()->GetName() + "'"); - object->Start(); + Log(LogDebug, "config", "Activating object '" + object->GetName() + "' of type '" + object->GetType()->GetName() + "'"); + object->Start(); - ASSERT(object->IsActive()); + ASSERT(object->IsActive()); + } } } diff --git a/lib/icinga/host.cpp b/lib/icinga/host.cpp index b886504e7..5cbc2f021 100644 --- a/lib/icinga/host.cpp +++ b/lib/icinga/host.cpp @@ -246,7 +246,7 @@ void Host::UpdateSlaveServices(void) ConfigItem::Ptr serviceItem = builder->Compile(); DynamicObject::Ptr dobj = serviceItem->Commit(); - dobj->Start(); + dobj->OnConfigLoaded(); } } diff --git a/lib/icinga/service-notification.cpp b/lib/icinga/service-notification.cpp index d7c520f8e..f4b7685f3 100644 --- a/lib/icinga/service-notification.cpp +++ b/lib/icinga/service-notification.cpp @@ -194,7 +194,7 @@ void Service::UpdateSlaveNotifications(void) ConfigItem::Ptr notificationItem = builder->Compile(); DynamicObject::Ptr dobj = notificationItem->Commit(); - dobj->Start(); + dobj->OnConfigLoaded(); } } }