From 3847e37df121132ef4ad235f761dacfeca26906e Mon Sep 17 00:00:00 2001 From: Michael Friedrich Date: Tue, 5 Dec 2017 14:17:57 +0100 Subject: [PATCH] Drop CompatUtility::GetCheckableAcknowledgementType() This already returns an integer. --- lib/compat/statusdatawriter.cpp | 2 +- lib/db_ido/hostdbobject.cpp | 2 +- lib/db_ido/servicedbobject.cpp | 2 +- lib/icinga/compatutility.cpp | 5 ----- lib/icinga/compatutility.hpp | 1 - lib/livestatus/hoststable.cpp | 2 +- lib/livestatus/servicestable.cpp | 2 +- 7 files changed, 5 insertions(+), 11 deletions(-) diff --git a/lib/compat/statusdatawriter.cpp b/lib/compat/statusdatawriter.cpp index e5b41f03e..fb1ac5463 100644 --- a/lib/compat/statusdatawriter.cpp +++ b/lib/compat/statusdatawriter.cpp @@ -388,7 +388,7 @@ void StatusDataWriter::DumpCheckableStatusAttrs(std::ostream& fp, const Checkabl "\t" "is_flapping=" << CompatUtility::GetCheckableIsFlapping(checkable) << "\n" "\t" "percent_state_change=" << CompatUtility::GetCheckablePercentStateChange(checkable) << "\n" "\t" "problem_has_been_acknowledged=" << (checkable->GetAcknowledgement() != AcknowledgementNone ? 1 : 0) << "\n" - "\t" "acknowledgement_type=" << CompatUtility::GetCheckableAcknowledgementType(checkable) << "\n" + "\t" "acknowledgement_type=" << checkable->GetAcknowledgement() << "\n" "\t" "acknowledgement_end_time=" << checkable->GetAcknowledgementExpiry() << "\n" "\t" "scheduled_downtime_depth=" << checkable->GetDowntimeDepth() << "\n" "\t" "last_notification=" << CompatUtility::GetCheckableNotificationLastNotification(checkable) << "\n" diff --git a/lib/db_ido/hostdbobject.cpp b/lib/db_ido/hostdbobject.cpp index b1477a3ee..d7bf870d2 100644 --- a/lib/db_ido/hostdbobject.cpp +++ b/lib/db_ido/hostdbobject.cpp @@ -154,7 +154,7 @@ Dictionary::Ptr HostDbObject::GetStatusFields() const fields->Set("no_more_notifications", Empty); fields->Set("notifications_enabled", CompatUtility::GetCheckableNotificationsEnabled(host)); fields->Set("problem_has_been_acknowledged", host->GetAcknowledgement() != AcknowledgementNone); - fields->Set("acknowledgement_type", CompatUtility::GetCheckableAcknowledgementType(host)); + fields->Set("acknowledgement_type", host->GetAcknowledgement()); fields->Set("current_notification_number", CompatUtility::GetCheckableNotificationNotificationNumber(host)); fields->Set("passive_checks_enabled", CompatUtility::GetCheckablePassiveChecksEnabled(host)); fields->Set("active_checks_enabled", CompatUtility::GetCheckableActiveChecksEnabled(host)); diff --git a/lib/db_ido/servicedbobject.cpp b/lib/db_ido/servicedbobject.cpp index 3263f40f1..74663ce62 100644 --- a/lib/db_ido/servicedbobject.cpp +++ b/lib/db_ido/servicedbobject.cpp @@ -142,7 +142,7 @@ Dictionary::Ptr ServiceDbObject::GetStatusFields() const fields->Set("no_more_notifications", Empty); fields->Set("notifications_enabled", CompatUtility::GetCheckableNotificationsEnabled(service)); fields->Set("problem_has_been_acknowledged", service->GetAcknowledgement() != AcknowledgementNone); - fields->Set("acknowledgement_type", CompatUtility::GetCheckableAcknowledgementType(service)); + fields->Set("acknowledgement_type", service->GetAcknowledgement()); fields->Set("current_notification_number", CompatUtility::GetCheckableNotificationNotificationNumber(service)); fields->Set("passive_checks_enabled", CompatUtility::GetCheckablePassiveChecksEnabled(service)); fields->Set("active_checks_enabled", CompatUtility::GetCheckableActiveChecksEnabled(service)); diff --git a/lib/icinga/compatutility.cpp b/lib/icinga/compatutility.cpp index 52155ba34..2d1531e8f 100644 --- a/lib/icinga/compatutility.cpp +++ b/lib/icinga/compatutility.cpp @@ -207,11 +207,6 @@ int CompatUtility::GetCheckableHasBeenChecked(const Checkable::Ptr& checkable) return (checkable->GetLastCheckResult() ? 1 : 0); } -int CompatUtility::GetCheckableAcknowledgementType(const Checkable::Ptr& checkable) -{ - return static_cast(checkable->GetAcknowledgement()); -} - int CompatUtility::GetCheckablePassiveChecksEnabled(const Checkable::Ptr& checkable) { return (checkable->GetEnablePassiveChecks() ? 1 : 0); diff --git a/lib/icinga/compatutility.hpp b/lib/icinga/compatutility.hpp index b2d77e358..1daeefcf6 100644 --- a/lib/icinga/compatutility.hpp +++ b/lib/icinga/compatutility.hpp @@ -55,7 +55,6 @@ public: static double GetCheckableRetryInterval(const Checkable::Ptr& checkable); static String GetCheckableCheckPeriod(const Checkable::Ptr& checkable); static int GetCheckableHasBeenChecked(const Checkable::Ptr& checkable); - static int GetCheckableAcknowledgementType(const Checkable::Ptr& checkable); static int GetCheckablePassiveChecksEnabled(const Checkable::Ptr& checkable); static int GetCheckableActiveChecksEnabled(const Checkable::Ptr& checkable); static int GetCheckableEventHandlerEnabled(const Checkable::Ptr& checkable); diff --git a/lib/livestatus/hoststable.cpp b/lib/livestatus/hoststable.cpp index e2b920134..6d79a8c87 100644 --- a/lib/livestatus/hoststable.cpp +++ b/lib/livestatus/hoststable.cpp @@ -512,7 +512,7 @@ Value HostsTable::AcknowledgementTypeAccessor(const Value& row) return Empty; ObjectLock olock(host); - return CompatUtility::GetCheckableAcknowledgementType(host); + return host->GetAcknowledgement(); } Value HostsTable::CheckTypeAccessor(const Value& row) diff --git a/lib/livestatus/servicestable.cpp b/lib/livestatus/servicestable.cpp index d3ecee4cb..d9a303b4b 100644 --- a/lib/livestatus/servicestable.cpp +++ b/lib/livestatus/servicestable.cpp @@ -571,7 +571,7 @@ Value ServicesTable::AcknowledgementTypeAccessor(const Value& row) return Empty; ObjectLock olock(service); - return CompatUtility::GetCheckableAcknowledgementType(service); + return service->GetAcknowledgement(); } Value ServicesTable::NoMoreNotificationsAccessor(const Value& row)