From adce8e95bc5ae50596254faee2ee035b74215a5c Mon Sep 17 00:00:00 2001 From: Gunnar Beutner Date: Fri, 28 Mar 2014 18:26:46 +0100 Subject: [PATCH] Move the apply rule handler to the Service class. Refs #5878 --- lib/icinga/CMakeLists.txt | 4 ++-- lib/icinga/host.h | 3 --- lib/icinga/{host-apply.cpp => service-apply.cpp} | 10 +++++----- lib/icinga/service.h | 3 +++ 4 files changed, 10 insertions(+), 10 deletions(-) rename lib/icinga/{host-apply.cpp => service-apply.cpp} (92%) diff --git a/lib/icinga/CMakeLists.txt b/lib/icinga/CMakeLists.txt index 5ea9d54ff..ca0607913 100644 --- a/lib/icinga/CMakeLists.txt +++ b/lib/icinga/CMakeLists.txt @@ -43,12 +43,12 @@ add_library(icinga SHARED api.cpp api.h checkcommand.cpp checkcommand.th checkresult.cpp checkresult.th cib.cpp command.cpp command.th comment.cpp comment.th compatutility.cpp dependency.cpp dependency.th domain.cpp domain.th downtime.cpp downtime.th eventcommand.cpp eventcommand.th - externalcommandprocessor.cpp host.cpp host.th host-apply.cpp hostgroup.cpp hostgroup.th + externalcommandprocessor.cpp host.cpp host.th hostgroup.cpp hostgroup.th icingaapplication.cpp icingaapplication.th icingastatuswriter.cpp icingastatuswriter.th legacytimeperiod.cpp macroprocessor.cpp macroresolver.cpp notificationcommand.cpp notificationcommand.th notification.cpp notification.th perfdatavalue.cpp perfdatavalue.th - pluginutility.cpp scheduleddowntime.cpp scheduleddowntime.th service-check.cpp + pluginutility.cpp scheduleddowntime.cpp scheduleddowntime.th service-apply.cpp service-check.cpp service-comment.cpp service.cpp service-dependency.cpp service-downtime.cpp service-event.cpp service-flapping.cpp service.th servicegroup.cpp servicegroup.th service-notification.cpp timeperiod.cpp timeperiod.th user.cpp user.th diff --git a/lib/icinga/host.h b/lib/icinga/host.h index bf1ae422e..5e0dfa056 100644 --- a/lib/icinga/host.h +++ b/lib/icinga/host.h @@ -102,9 +102,6 @@ public: virtual bool ResolveMacro(const String& macro, const CheckResult::Ptr& cr, String *result) const; - static void RegisterApplyRuleHandler(void); - static void EvaluateApplyRules(const std::vector& rules); - protected: virtual void Stop(void); diff --git a/lib/icinga/host-apply.cpp b/lib/icinga/service-apply.cpp similarity index 92% rename from lib/icinga/host-apply.cpp rename to lib/icinga/service-apply.cpp index 3fed31047..61aa9fe4b 100644 --- a/lib/icinga/host-apply.cpp +++ b/lib/icinga/service-apply.cpp @@ -17,7 +17,7 @@ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA. * ******************************************************************************/ -#include "icinga/host.h" +#include "icinga/service.h" #include "config/configitembuilder.h" #include "base/initialize.h" #include "base/dynamictype.h" @@ -28,14 +28,14 @@ using namespace icinga; -INITIALIZE_ONCE(&Host::RegisterApplyRuleHandler); +INITIALIZE_ONCE(&Service::RegisterApplyRuleHandler); -void Host::RegisterApplyRuleHandler(void) +void Service::RegisterApplyRuleHandler(void) { - ApplyRule::RegisterType("Service", &Host::EvaluateApplyRules, 1); + ApplyRule::RegisterType("Service", &Service::EvaluateApplyRules, 1); } -void Host::EvaluateApplyRules(const std::vector& rules) +void Service::EvaluateApplyRules(const std::vector& rules) { BOOST_FOREACH(const Host::Ptr& host, DynamicType::GetObjects()) { CONTEXT("Evaluating 'apply' rules for Host '" + host->GetName() + "'"); diff --git a/lib/icinga/service.h b/lib/icinga/service.h index 3a76626f1..657dcddcf 100644 --- a/lib/icinga/service.h +++ b/lib/icinga/service.h @@ -280,6 +280,9 @@ public: void RemoveReverseDependency(const shared_ptr& dep); std::set > GetReverseDependencies(void) const; + static void RegisterApplyRuleHandler(void); + static void EvaluateApplyRules(const std::vector& rules); + protected: virtual void Start(void);