]> granicus.if.org Git - icinga2/commitdiff
Move the apply rule handler to the Service class.
authorGunnar Beutner <gunnar@beutner.name>
Fri, 28 Mar 2014 17:26:46 +0000 (18:26 +0100)
committerGunnar Beutner <gunnar.beutner@netways.de>
Fri, 28 Mar 2014 18:45:02 +0000 (19:45 +0100)
Refs #5878

lib/icinga/CMakeLists.txt
lib/icinga/host.h
lib/icinga/service-apply.cpp [moved from lib/icinga/host-apply.cpp with 92% similarity]
lib/icinga/service.h

index 5ea9d54ffb63f711cae256f7eca6c40e7fbebd3f..ca0607913667fcac811a8f158939441ea880de65 100644 (file)
@@ -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
index bf1ae422eb79b0fc831fda39f0bc52ac442a7ef1..5e0dfa05639c5a8a7ae3c11a1cd6903e42e6e25c 100644 (file)
@@ -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<ApplyRule>& rules);
-
 protected:
        virtual void Stop(void);
 
similarity index 92%
rename from lib/icinga/host-apply.cpp
rename to lib/icinga/service-apply.cpp
index 3fed310476654f36d7bf7e0bf3a7f71ebb7e300e..61aa9fe4b73118ead7f0520ec83644259895c85f 100644 (file)
@@ -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"
 
 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<ApplyRule>& rules)
+void Service::EvaluateApplyRules(const std::vector<ApplyRule>& rules)
 {
        BOOST_FOREACH(const Host::Ptr& host, DynamicType::GetObjects<Host>()) {
                CONTEXT("Evaluating 'apply' rules for Host '" + host->GetName() + "'");
index 3a76626f19ac2198891c76360a3eb72823fe886e..657dcddcf7010c0bf54ea28cb231bceef72dcbfc 100644 (file)
@@ -280,6 +280,9 @@ public:
        void RemoveReverseDependency(const shared_ptr<Dependency>& dep);
        std::set<shared_ptr<Dependency> > GetReverseDependencies(void) const;
 
+       static void RegisterApplyRuleHandler(void);
+       static void EvaluateApplyRules(const std::vector<ApplyRule>& rules);
+
 protected:
        virtual void Start(void);