From: Gunnar Beutner Date: Fri, 3 Aug 2012 13:35:50 +0000 (+0200) Subject: Fixed incorrect object type. X-Git-Tag: v0.0.1~171 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=e7953366112bbfb0b868c0aaf4a7c755be411b99;p=icinga2 Fixed incorrect object type. --- diff --git a/components/convenience/conveniencecomponent.cpp b/components/convenience/conveniencecomponent.cpp index 50d55ac4b..f8bf2aaa6 100644 --- a/components/convenience/conveniencecomponent.cpp +++ b/components/convenience/conveniencecomponent.cpp @@ -70,15 +70,15 @@ static void CopyServiceAttributes(const Host::Ptr& host, TDict serviceDesc, void ConvenienceComponent::HostCommittedHandler(const ConfigItem::Ptr& item) { - if (item->GetType() != "host") + if (item->GetType() != "Host") return; - Host::Ptr host = Host::GetByName(item->GetName()); - /* ignore abstract host objects */ - if (!host) + if (!Host::Exists(item->GetName())) return; + Host::Ptr host = Host::GetByName(item->GetName()); + Dictionary::Ptr oldServices = host->Get("convenience_services"); Dictionary::Ptr newServices; @@ -95,7 +95,7 @@ void ConvenienceComponent::HostCommittedHandler(const ConfigItem::Ptr& item) String name = namebuf.str(); ConfigItemBuilder::Ptr builder = boost::make_shared(item->GetDebugInfo()); - builder->SetType("service"); + builder->SetType("Service"); builder->SetName(name); builder->AddExpression("host_name", OperatorSet, item->GetName()); builder->AddExpression("alias", OperatorSet, svcname); @@ -141,7 +141,7 @@ void ConvenienceComponent::HostCommittedHandler(const ConfigItem::Ptr& item) void ConvenienceComponent::HostRemovedHandler(const ConfigItem::Ptr& item) { - if (item->GetType() != "host") + if (item->GetType() != "Host") return; DynamicObject::Ptr host = item->GetDynamicObject();