Fix missing target types in ScheduledDowntime apply.

Fixes #5955
This commit is contained in:
Michael Friedrich 2014-04-07 13:06:28 +02:00
parent e97e1cf63f
commit 0e3b387a70
1 changed files with 15 additions and 4 deletions

View File

@ -93,14 +93,25 @@ void ScheduledDowntime::EvaluateApplyRule(const Checkable::Ptr& checkable, const
void ScheduledDowntime::EvaluateApplyRules(const std::vector<ApplyRule>& rules)
{
BOOST_FOREACH(const Host::Ptr& host, DynamicType::GetObjects<Host>()) {
CONTEXT("Evaluating 'apply' rules for host '" + host->GetName() + "'");
BOOST_FOREACH(const ApplyRule& rule, rules) {
if (rule.GetTargetType() != "Host")
continue;
EvaluateApplyRule(host, rule);
}
}
BOOST_FOREACH(const Service::Ptr& service, DynamicType::GetObjects<Service>()) {
CONTEXT("Evaluating 'apply' rules for Service '" + service->GetName() + "'");
Dictionary::Ptr locals = make_shared<Dictionary>();
locals->Set("host", service->GetHost());
locals->Set("service", service);
BOOST_FOREACH(const ApplyRule& rule, rules) {
if (rule.GetTargetType() != "Service")
continue;
EvaluateApplyRule(service, rule);
}
}
}