]> granicus.if.org Git - icinga2/commitdiff
Drop CompatUtility::*Command helpers
authorMichael Friedrich <michael.friedrich@icinga.com>
Tue, 5 Dec 2017 18:30:45 +0000 (19:30 +0100)
committerMichael Friedrich <michael.friedrich@icinga.com>
Mon, 15 Jan 2018 12:39:34 +0000 (13:39 +0100)
lib/db_ido/hostdbobject.cpp
lib/db_ido/servicedbobject.cpp
lib/icinga/compatutility.cpp
lib/icinga/compatutility.hpp

index 8aec40799a01b083c8a136aedebb7b7b046f1815..8cb682409a0bb226ebaf0393353ff89450908a82 100644 (file)
@@ -172,8 +172,6 @@ Dictionary::Ptr HostDbObject::GetStatusFields() const
        fields->Set("failure_prediction_enabled", Empty);
        fields->Set("process_performance_data", host->GetEnablePerfdata());
        fields->Set("obsess_over_host", Empty);
-       fields->Set("event_handler", CompatUtility::GetCheckableEventHandler(host));
-       fields->Set("check_command", CompatUtility::GetCheckableCheckCommand(host));
        fields->Set("normal_check_interval", CompatUtility::GetCheckableCheckInterval(host));
        fields->Set("retry_check_interval", CompatUtility::GetCheckableRetryInterval(host));
        fields->Set("check_timeperiod_object_id", host->GetCheckPeriod());
@@ -181,6 +179,16 @@ Dictionary::Ptr HostDbObject::GetStatusFields() const
 
        fields->Set("original_attributes", JsonEncode(host->GetOriginalAttributes()));
 
+       EventCommand::Ptr eventCommand = host->GetEventCommand();
+
+       if (eventCommand)
+               fields->Set("event_handler", eventCommand->GetName());
+
+       CheckCommand::Ptr checkCommand = host->GetCheckCommand();
+
+       if (checkCommand)
+               fields->Set("check_command", checkCommand->GetName());
+
        return fields;
 }
 
index 28886fc3fd2fd5d0b4cf9fdc3375775349024881..597ad08dee2da2294c93a2a907dac95abf312de4 100644 (file)
@@ -158,8 +158,6 @@ Dictionary::Ptr ServiceDbObject::GetStatusFields() const
 
        fields->Set("scheduled_downtime_depth", service->GetDowntimeDepth());
        fields->Set("process_performance_data", service->GetEnablePerfdata());
-       fields->Set("event_handler", CompatUtility::GetCheckableEventHandler(service));
-       fields->Set("check_command", CompatUtility::GetCheckableCheckCommand(service));
        fields->Set("normal_check_interval", CompatUtility::GetCheckableCheckInterval(service));
        fields->Set("retry_check_interval", CompatUtility::GetCheckableRetryInterval(service));
        fields->Set("check_timeperiod_object_id", service->GetCheckPeriod());
@@ -167,6 +165,16 @@ Dictionary::Ptr ServiceDbObject::GetStatusFields() const
 
        fields->Set("original_attributes", JsonEncode(service->GetOriginalAttributes()));
 
+       EventCommand::Ptr eventCommand = service->GetEventCommand();
+
+       if (eventCommand)
+               fields->Set("event_handler", eventCommand->GetName());
+
+       CheckCommand::Ptr checkCommand = service->GetCheckCommand();
+
+       if (checkCommand)
+               fields->Set("check_command", checkCommand->GetName());
+
        return fields;
 }
 
index 2f3557a36cbf07559735cd380a69367a7a927ec8..031754a9e674cb78a0631cde6595213188f8361e 100644 (file)
@@ -202,28 +202,6 @@ String CompatUtility::GetCheckableCheckPeriod(const Checkable::Ptr& checkable)
                return "24x7";
 }
 
-String CompatUtility::GetCheckableEventHandler(const Checkable::Ptr& checkable)
-{
-       String event_command_str;
-       EventCommand::Ptr eventcommand = checkable->GetEventCommand();
-
-       if (eventcommand)
-               event_command_str = eventcommand->GetName();
-
-       return event_command_str;
-}
-
-String CompatUtility::GetCheckableCheckCommand(const Checkable::Ptr& checkable)
-{
-       String check_command_str;
-       CheckCommand::Ptr checkcommand = checkable->GetCheckCommand();
-
-       if (checkcommand)
-               check_command_str = checkcommand->GetName();
-
-       return check_command_str;
-}
-
 int CompatUtility::GetCheckableIsVolatile(const Checkable::Ptr& checkable)
 {
        return (checkable->GetVolatile() ? 1 : 0);
index 4f61279e9d84e394a80f4430750fed56241154a7..0ec8f0eab563a9212bb6992ccb40503a8a06070b 100644 (file)
@@ -55,9 +55,6 @@ public:
        static double GetCheckableRetryInterval(const Checkable::Ptr& checkable);
        static String GetCheckableCheckPeriod(const Checkable::Ptr& checkable);
 
-       static String GetCheckableEventHandler(const Checkable::Ptr& checkable);
-       static String GetCheckableCheckCommand(const Checkable::Ptr& checkable);
-
        static int GetCheckableIsVolatile(const Checkable::Ptr& checkable);
        static double GetCheckableLowFlapThreshold(const Checkable::Ptr& checkable);
        static double GetCheckableHighFlapThreshold(const Checkable::Ptr& checkable);