From 334f633b0a12410078fdae267d6940e7f96d5914 Mon Sep 17 00:00:00 2001 From: Michael Friedrich Date: Tue, 5 Dec 2017 14:23:15 +0100 Subject: [PATCH] Drop CompatUtility::GetCheckableHasBeenChecked() and use Checkable::HasBeenChecked() --- 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 fb1ac5463..eae647e41 100644 --- a/lib/compat/statusdatawriter.cpp +++ b/lib/compat/statusdatawriter.cpp @@ -338,7 +338,7 @@ void StatusDataWriter::DumpCheckableStatusAttrs(std::ostream& fp, const Checkabl "\t" "check_period=" << CompatUtility::GetCheckableCheckPeriod(checkable) << "\n" "\t" "check_interval=" << CompatUtility::GetCheckableCheckInterval(checkable) << "\n" "\t" "retry_interval=" << CompatUtility::GetCheckableRetryInterval(checkable) << "\n" - "\t" "has_been_checked=" << CompatUtility::GetCheckableHasBeenChecked(checkable) << "\n" + "\t" "has_been_checked=" << (checkable->HasBeenChecked() ? 1 : 0) << "\n" "\t" "should_be_scheduled=" << checkable->GetEnableActiveChecks() << "\n" "\t" "event_handler_enabled=" << CompatUtility::GetCheckableEventHandlerEnabled(checkable) << "\n"; diff --git a/lib/db_ido/hostdbobject.cpp b/lib/db_ido/hostdbobject.cpp index d7bf870d2..7749b275a 100644 --- a/lib/db_ido/hostdbobject.cpp +++ b/lib/db_ido/hostdbobject.cpp @@ -132,7 +132,7 @@ Dictionary::Ptr HostDbObject::GetStatusFields() const } fields->Set("current_state", CompatUtility::GetHostCurrentState(host)); - fields->Set("has_been_checked", CompatUtility::GetCheckableHasBeenChecked(host)); + fields->Set("has_been_checked", host->HasBeenChecked()); fields->Set("should_be_scheduled", host->GetEnableActiveChecks()); fields->Set("current_check_attempt", host->GetCheckAttempt()); fields->Set("max_check_attempts", host->GetMaxCheckAttempts()); diff --git a/lib/db_ido/servicedbobject.cpp b/lib/db_ido/servicedbobject.cpp index 74663ce62..eff6b71a8 100644 --- a/lib/db_ido/servicedbobject.cpp +++ b/lib/db_ido/servicedbobject.cpp @@ -119,7 +119,7 @@ Dictionary::Ptr ServiceDbObject::GetStatusFields() const } fields->Set("current_state", service->GetState()); - fields->Set("has_been_checked", CompatUtility::GetCheckableHasBeenChecked(service)); + fields->Set("has_been_checked", service->HasBeenChecked()); fields->Set("should_be_scheduled", service->GetEnableActiveChecks()); fields->Set("current_check_attempt", service->GetCheckAttempt()); fields->Set("max_check_attempts", service->GetMaxCheckAttempts()); diff --git a/lib/icinga/compatutility.cpp b/lib/icinga/compatutility.cpp index 2d1531e8f..3b5d8c756 100644 --- a/lib/icinga/compatutility.cpp +++ b/lib/icinga/compatutility.cpp @@ -202,11 +202,6 @@ String CompatUtility::GetCheckableCheckPeriod(const Checkable::Ptr& checkable) return "24x7"; } -int CompatUtility::GetCheckableHasBeenChecked(const Checkable::Ptr& checkable) -{ - return (checkable->GetLastCheckResult() ? 1 : 0); -} - 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 1daeefcf6..e5a9a89e1 100644 --- a/lib/icinga/compatutility.hpp +++ b/lib/icinga/compatutility.hpp @@ -54,7 +54,6 @@ public: static double GetCheckableCheckInterval(const Checkable::Ptr& checkable); static double GetCheckableRetryInterval(const Checkable::Ptr& checkable); static String GetCheckableCheckPeriod(const Checkable::Ptr& checkable); - static int GetCheckableHasBeenChecked(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 6d79a8c87..49dd9fac6 100644 --- a/lib/livestatus/hoststable.cpp +++ b/lib/livestatus/hoststable.cpp @@ -602,7 +602,7 @@ Value HostsTable::HasBeenCheckedAccessor(const Value& row) if (!host) return Empty; - return CompatUtility::GetCheckableHasBeenChecked(host); + return Convert::ToLong(host->HasBeenChecked()); } Value HostsTable::CurrentNotificationNumberAccessor(const Value& row) diff --git a/lib/livestatus/servicestable.cpp b/lib/livestatus/servicestable.cpp index d9a303b4b..072535ca9 100644 --- a/lib/livestatus/servicestable.cpp +++ b/lib/livestatus/servicestable.cpp @@ -509,7 +509,7 @@ Value ServicesTable::HasBeenCheckedAccessor(const Value& row) if (!service) return Empty; - return CompatUtility::GetCheckableHasBeenChecked(service); + return Convert::ToLong(service->HasBeenChecked()); } Value ServicesTable::LastStateAccessor(const Value& row) -- 2.40.0