From 0e3b387a707af9156237c4398f27178b606a7051 Mon Sep 17 00:00:00 2001 From: Michael Friedrich Date: Mon, 7 Apr 2014 13:06:28 +0200 Subject: [PATCH] Fix missing target types in ScheduledDowntime apply. Fixes #5955 --- lib/icinga/scheduleddowntime-apply.cpp | 19 +++++++++++++++---- 1 file changed, 15 insertions(+), 4 deletions(-) diff --git a/lib/icinga/scheduleddowntime-apply.cpp b/lib/icinga/scheduleddowntime-apply.cpp index 37d8e8882..37aeb6bc5 100644 --- a/lib/icinga/scheduleddowntime-apply.cpp +++ b/lib/icinga/scheduleddowntime-apply.cpp @@ -93,14 +93,25 @@ void ScheduledDowntime::EvaluateApplyRule(const Checkable::Ptr& checkable, const void ScheduledDowntime::EvaluateApplyRules(const std::vector& rules) { + BOOST_FOREACH(const Host::Ptr& host, DynamicType::GetObjects()) { + 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()) { CONTEXT("Evaluating 'apply' rules for Service '" + service->GetName() + "'"); - Dictionary::Ptr locals = make_shared(); - locals->Set("host", service->GetHost()); - locals->Set("service", service); - BOOST_FOREACH(const ApplyRule& rule, rules) { + if (rule.GetTargetType() != "Service") + continue; + + EvaluateApplyRule(service, rule); } } } -- 2.40.0