mirror of https://github.com/Icinga/icinga2.git
Build dependant services using extracted expression lists.
This commit is contained in:
parent
a21cf21d52
commit
969458b480
|
@ -220,10 +220,18 @@ void Expression::Extract(const std::vector<String>& 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<ExpressionList>())
|
||||
BOOST_THROW_EXCEPTION(std::invalid_argument("Specified path does not exist."));
|
||||
|
||||
ExpressionList::Ptr exprl = m_Value;
|
||||
std::vector<String> 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);
|
||||
|
|
|
@ -251,10 +251,18 @@ void Host::UpdateSlaveServices(void)
|
|||
builder->AddExpression("display_name", OperatorSet, svcname);
|
||||
builder->AddExpression("short_name", OperatorSet, svcname);
|
||||
|
||||
CopyServiceAttributes<false>(this, builder);
|
||||
std::vector<String> path;
|
||||
path.push_back("services");
|
||||
path.push_back(svcname);
|
||||
|
||||
ExpressionList::Ptr exprl = boost::make_shared<ExpressionList>();
|
||||
item->GetLinkedExpressionList()->Extract(path, exprl);
|
||||
builder->AddExpressionList(exprl);
|
||||
|
||||
/*CopyServiceAttributes<false>(this, builder);
|
||||
|
||||
if (!svcdesc.IsObjectType<Dictionary>())
|
||||
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<true>(service, builder);
|
||||
//CopyServiceAttributes<true>(service, builder);
|
||||
|
||||
ConfigItem::Ptr serviceItem = builder->Compile();
|
||||
DynamicObject::Ptr dobj = serviceItem->Commit();
|
||||
|
|
Loading…
Reference in New Issue