From 5466197d29930352ac36b1bd4f4cbcb71d5db607 Mon Sep 17 00:00:00 2001 From: Michael Friedrich Date: Tue, 5 Dec 2017 19:30:45 +0100 Subject: [PATCH] Drop CompatUtility::*Command helpers --- lib/db_ido/hostdbobject.cpp | 12 ++++++++++-- lib/db_ido/servicedbobject.cpp | 12 ++++++++++-- lib/icinga/compatutility.cpp | 22 ---------------------- lib/icinga/compatutility.hpp | 3 --- 4 files changed, 20 insertions(+), 29 deletions(-) diff --git a/lib/db_ido/hostdbobject.cpp b/lib/db_ido/hostdbobject.cpp index 8aec40799..8cb682409 100644 --- a/lib/db_ido/hostdbobject.cpp +++ b/lib/db_ido/hostdbobject.cpp @@ -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; } diff --git a/lib/db_ido/servicedbobject.cpp b/lib/db_ido/servicedbobject.cpp index 28886fc3f..597ad08de 100644 --- a/lib/db_ido/servicedbobject.cpp +++ b/lib/db_ido/servicedbobject.cpp @@ -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; } diff --git a/lib/icinga/compatutility.cpp b/lib/icinga/compatutility.cpp index 2f3557a36..031754a9e 100644 --- a/lib/icinga/compatutility.cpp +++ b/lib/icinga/compatutility.cpp @@ -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); diff --git a/lib/icinga/compatutility.hpp b/lib/icinga/compatutility.hpp index 4f61279e9..0ec8f0eab 100644 --- a/lib/icinga/compatutility.hpp +++ b/lib/icinga/compatutility.hpp @@ -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);