diff --git a/lib/config/expression.cpp b/lib/config/expression.cpp index d411fada1..3a240a770 100644 --- a/lib/config/expression.cpp +++ b/lib/config/expression.cpp @@ -220,10 +220,18 @@ void Expression::Extract(const std::vector& path, const ExpressionList:: ASSERT(!path.empty()); if (path[0] == m_Key) { - if (path.size() > 1) - BOOST_THROW_EXCEPTION(std::invalid_argument("Specified path does not exist.")); - else + if (path.size() == 1) { result->AddExpression(*this); + + return; + } + + if (!m_Value.IsObjectType()) + BOOST_THROW_EXCEPTION(std::invalid_argument("Specified path does not exist.")); + + ExpressionList::Ptr exprl = m_Value; + std::vector sub_path(path.begin() + 1, path.end()); + exprl->Extract(sub_path, result); } else if (m_Operator == OperatorExecute) { ExpressionList::Ptr exprl = m_Value; exprl->Extract(path, result); diff --git a/lib/icinga/host.cpp b/lib/icinga/host.cpp index 5ad346036..b92539690 100644 --- a/lib/icinga/host.cpp +++ b/lib/icinga/host.cpp @@ -251,10 +251,18 @@ void Host::UpdateSlaveServices(void) builder->AddExpression("display_name", OperatorSet, svcname); builder->AddExpression("short_name", OperatorSet, svcname); - CopyServiceAttributes(this, builder); + std::vector path; + path.push_back("services"); + path.push_back(svcname); + + ExpressionList::Ptr exprl = boost::make_shared(); + item->GetLinkedExpressionList()->Extract(path, exprl); + builder->AddExpressionList(exprl); + + /*CopyServiceAttributes(this, builder); if (!svcdesc.IsObjectType()) - BOOST_THROW_EXCEPTION(std::invalid_argument("Service description must be either a string or a dictionary.")); + BOOST_THROW_EXCEPTION(std::invalid_argument("Service description must be either a string or a dictionary."));*/ Dictionary::Ptr service = svcdesc; @@ -268,7 +276,7 @@ void Host::UpdateSlaveServices(void) } } - CopyServiceAttributes(service, builder); + //CopyServiceAttributes(service, builder); ConfigItem::Ptr serviceItem = builder->Compile(); DynamicObject::Ptr dobj = serviceItem->Commit();