From 1813c0932c372d77adc4fb81d66b6c088f3c7faa Mon Sep 17 00:00:00 2001 From: Michael Friedrich Date: Mon, 28 Sep 2015 18:58:00 +0200 Subject: [PATCH] Remove dead code from old modified attributes refs #9851 --- lib/compat/statusdatawriter.cpp | 1 - lib/db_ido/dbobject.cpp | 14 ---- lib/db_ido/hostdbobject.cpp | 1 - lib/db_ido/servicedbobject.cpp | 1 - lib/db_ido/userdbobject.cpp | 3 - lib/icinga/checkable.cpp | 12 ---- lib/icinga/checkable.hpp | 3 - lib/icinga/command.cpp | 11 --- lib/icinga/command.hpp | 3 - lib/icinga/compatutility.cpp | 56 ---------------- lib/icinga/compatutility.hpp | 2 - lib/icinga/customvarobject.cpp | 17 ----- lib/icinga/customvarobject.hpp | 26 -------- lib/icinga/externalcommandprocessor.cpp | 89 ------------------------- lib/icinga/externalcommandprocessor.hpp | 8 --- lib/icinga/user.cpp | 12 ---- lib/icinga/user.hpp | 3 - lib/livestatus/commandstable.cpp | 25 +------ lib/livestatus/commandstable.hpp | 2 - lib/livestatus/contactstable.cpp | 25 +------ lib/livestatus/contactstable.hpp | 2 - lib/livestatus/hoststable.cpp | 24 +------ lib/livestatus/hoststable.hpp | 2 - lib/livestatus/servicestable.cpp | 24 +------ lib/livestatus/servicestable.hpp | 2 - 25 files changed, 8 insertions(+), 360 deletions(-) diff --git a/lib/compat/statusdatawriter.cpp b/lib/compat/statusdatawriter.cpp index 8f71cefcc..c0a21c03c 100644 --- a/lib/compat/statusdatawriter.cpp +++ b/lib/compat/statusdatawriter.cpp @@ -396,7 +396,6 @@ void StatusDataWriter::DumpCheckableStatusAttrs(std::ostream& fp, const Checkabl "\t" "last_notification=" << CompatUtility::GetCheckableNotificationLastNotification(checkable) << "\n" "\t" "next_notification=" << CompatUtility::GetCheckableNotificationNextNotification(checkable) << "\n" "\t" "current_notification_number=" << CompatUtility::GetCheckableNotificationNotificationNumber(checkable) << "\n" - "\t" "modified_attributes=" << checkable->GetModifiedAttributes() << "\n" "\t" "is_reachable=" << CompatUtility::GetCheckableIsReachable(checkable) << "\n"; } diff --git a/lib/db_ido/dbobject.cpp b/lib/db_ido/dbobject.cpp index c1aebbcb9..6a6f11201 100644 --- a/lib/db_ido/dbobject.cpp +++ b/lib/db_ido/dbobject.cpp @@ -181,18 +181,11 @@ void DbObject::SendVarsConfigUpdate(void) } else value = kv.second; - int overridden = custom_var_object->IsVarOverridden(kv.first) ? 1 : 0; - - Log(LogDebug, "DbObject") - << "object customvar key: '" << kv.first << "' value: '" << kv.second - << "' overridden: " << overridden; - Dictionary::Ptr fields = new Dictionary(); fields->Set("varname", kv.first); fields->Set("varvalue", value); fields->Set("is_json", is_json); fields->Set("config_type", 1); - fields->Set("has_been_modified", overridden); fields->Set("object_id", obj); fields->Set("instance_id", 0); /* DbConnection class fills in real ID */ @@ -242,17 +235,10 @@ void DbObject::SendVarsStatusUpdate(void) } else value = kv.second; - int overridden = custom_var_object->IsVarOverridden(kv.first) ? 1 : 0; - - Log(LogDebug, "DbObject") - << "object customvar key: '" << kv.first << "' value: '" << kv.second - << "' overridden: " << overridden; - Dictionary::Ptr fields = new Dictionary(); fields->Set("varname", kv.first); fields->Set("varvalue", value); fields->Set("is_json", is_json); - fields->Set("has_been_modified", overridden); fields->Set("status_update_time", DbValue::FromTimestamp(Utility::GetTime())); fields->Set("object_id", obj); fields->Set("instance_id", 0); /* DbConnection class fills in real ID */ diff --git a/lib/db_ido/hostdbobject.cpp b/lib/db_ido/hostdbobject.cpp index 919061c27..c49040c11 100644 --- a/lib/db_ido/hostdbobject.cpp +++ b/lib/db_ido/hostdbobject.cpp @@ -163,7 +163,6 @@ Dictionary::Ptr HostDbObject::GetStatusFields(void) const fields->Set("failure_prediction_enabled", Empty); fields->Set("process_performance_data", CompatUtility::GetCheckableProcessPerformanceData(host)); fields->Set("obsess_over_host", Empty); - fields->Set("modified_host_attributes", host->GetModifiedAttributes()); fields->Set("event_handler", CompatUtility::GetCheckableEventHandler(host)); fields->Set("check_command", CompatUtility::GetCheckableCheckCommand(host)); fields->Set("normal_check_interval", CompatUtility::GetCheckableCheckInterval(host)); diff --git a/lib/db_ido/servicedbobject.cpp b/lib/db_ido/servicedbobject.cpp index 3791d4632..a9a640e69 100644 --- a/lib/db_ido/servicedbobject.cpp +++ b/lib/db_ido/servicedbobject.cpp @@ -162,7 +162,6 @@ Dictionary::Ptr ServiceDbObject::GetStatusFields(void) const fields->Set("normal_check_interval", CompatUtility::GetCheckableCheckInterval(service)); fields->Set("retry_check_interval", CompatUtility::GetCheckableRetryInterval(service)); fields->Set("check_timeperiod_object_id", service->GetCheckPeriod()); - fields->Set("modified_service_attributes", service->GetModifiedAttributes()); fields->Set("is_reachable", CompatUtility::GetCheckableIsReachable(service)); return fields; diff --git a/lib/db_ido/userdbobject.cpp b/lib/db_ido/userdbobject.cpp index 5387e0bdb..1e67a3e12 100644 --- a/lib/db_ido/userdbobject.cpp +++ b/lib/db_ido/userdbobject.cpp @@ -71,9 +71,6 @@ Dictionary::Ptr UserDbObject::GetStatusFields(void) const fields->Set("service_notifications_enabled", user->GetEnableNotifications()); fields->Set("last_host_notification", DbValue::FromTimestamp(user->GetLastNotification())); fields->Set("last_service_notification", DbValue::FromTimestamp(user->GetLastNotification())); - fields->Set("modified_attributes", user->GetModifiedAttributes()); - fields->Set("modified_host_attributes", Empty); - fields->Set("modified_service_attributes", Empty); return fields; } diff --git a/lib/icinga/checkable.cpp b/lib/icinga/checkable.cpp index 76f586307..fd985e995 100644 --- a/lib/icinga/checkable.cpp +++ b/lib/icinga/checkable.cpp @@ -139,18 +139,6 @@ void Checkable::ClearAcknowledgement(const MessageOrigin::Ptr& origin) OnAcknowledgementCleared(this, origin); } -int Checkable::GetModifiedAttributes(void) const -{ - //TODO-MA - return 0; -} - -void Checkable::SetModifiedAttributes(int flags, const MessageOrigin::Ptr& origin) -{ - //TODO-MA - return; -} - Endpoint::Ptr Checkable::GetCommandEndpoint(void) const { return Endpoint::GetByName(GetCommandEndpointRaw()); diff --git a/lib/icinga/checkable.hpp b/lib/icinga/checkable.hpp index 31b9c2011..cf828af93 100644 --- a/lib/icinga/checkable.hpp +++ b/lib/icinga/checkable.hpp @@ -103,9 +103,6 @@ public: void ExecuteCheck(); void ProcessCheckResult(const CheckResult::Ptr& cr, const MessageOrigin::Ptr& origin = MessageOrigin::Ptr()); - virtual int GetModifiedAttributes(void) const override; - virtual void SetModifiedAttributes(int flags, const MessageOrigin::Ptr& origin = MessageOrigin::Ptr()) override; - Endpoint::Ptr GetCommandEndpoint(void) const; bool IsCheckPending(void) const; diff --git a/lib/icinga/command.cpp b/lib/icinga/command.cpp index 8c656c1f0..e029322f5 100644 --- a/lib/icinga/command.cpp +++ b/lib/icinga/command.cpp @@ -28,17 +28,6 @@ using namespace icinga; REGISTER_TYPE(Command); -int Command::GetModifiedAttributes(void) const -{ - //TODO-MA - return 0; -} - -void Command::SetModifiedAttributes(int flags, const MessageOrigin::Ptr& origin) -{ - //TODO-MA -} - void Command::Validate(int types, const ValidationUtils& utils) { ObjectImpl::Validate(types, utils); diff --git a/lib/icinga/command.hpp b/lib/icinga/command.hpp index 0df51562c..9dc9723ab 100644 --- a/lib/icinga/command.hpp +++ b/lib/icinga/command.hpp @@ -40,9 +40,6 @@ public: //virtual Dictionary::Ptr Execute(const Object::Ptr& context) = 0; virtual void Validate(int types, const ValidationUtils& utils) override; - - int GetModifiedAttributes(void) const override; - void SetModifiedAttributes(int flags, const MessageOrigin::Ptr& origin = MessageOrigin::Ptr()) override; }; } diff --git a/lib/icinga/compatutility.cpp b/lib/icinga/compatutility.cpp index 709d9d5f9..17cf23ca9 100644 --- a/lib/icinga/compatutility.cpp +++ b/lib/icinga/compatutility.cpp @@ -388,62 +388,6 @@ String CompatUtility::GetCustomAttributeConfig(const CustomVarObject::Ptr& objec return vars->Get(name); } -Array::Ptr CompatUtility::GetModifiedAttributesList(const CustomVarObject::Ptr& object) -{ - Array::Ptr mod_attr_list = new Array(); - - if (object->GetType() != ConfigType::GetByName("Host") && - object->GetType() != ConfigType::GetByName("Service") && - object->GetType() != ConfigType::GetByName("User") && - object->GetType() != ConfigType::GetByName("CheckCommand") && - object->GetType() != ConfigType::GetByName("EventCommand") && - object->GetType() != ConfigType::GetByName("NotificationCommand")) - return mod_attr_list; - - int flags = object->GetModifiedAttributes(); - - if ((flags & ModAttrNotificationsEnabled)) - mod_attr_list->Add("notifications_enabled"); - - if ((flags & ModAttrActiveChecksEnabled)) - mod_attr_list->Add("active_checks_enabled"); - - if ((flags & ModAttrPassiveChecksEnabled)) - mod_attr_list->Add("passive_checks_enabled"); - - if ((flags & ModAttrFlapDetectionEnabled)) - mod_attr_list->Add("flap_detection_enabled"); - - if ((flags & ModAttrEventHandlerEnabled)) - mod_attr_list->Add("event_handler_enabled"); - - if ((flags & ModAttrPerformanceDataEnabled)) - mod_attr_list->Add("performance_data_enabled"); - - if ((flags & ModAttrNormalCheckInterval)) - mod_attr_list->Add("check_interval"); - - if ((flags & ModAttrRetryCheckInterval)) - mod_attr_list->Add("retry_interval"); - - if ((flags & ModAttrEventHandlerCommand)) - mod_attr_list->Add("event_handler_command"); - - if ((flags & ModAttrCheckCommand)) - mod_attr_list->Add("check_command"); - - if ((flags & ModAttrMaxCheckAttempts)) - mod_attr_list->Add("max_check_attemps"); - - if ((flags & ModAttrCheckTimeperiod)) - mod_attr_list->Add("check_timeperiod"); - - if ((flags & ModAttrCustomVariable)) - mod_attr_list->Add("custom_variable"); - - return mod_attr_list; -} - /* notifications */ int CompatUtility::GetCheckableNotificationsEnabled(const Checkable::Ptr& checkable) { diff --git a/lib/icinga/compatutility.hpp b/lib/icinga/compatutility.hpp index d97b4673f..b36dfcc86 100644 --- a/lib/icinga/compatutility.hpp +++ b/lib/icinga/compatutility.hpp @@ -82,8 +82,6 @@ public: static int GetCheckableInCheckPeriod(const Checkable::Ptr& checkable); static int GetCheckableInNotificationPeriod(const Checkable::Ptr& checkable); - static Array::Ptr GetModifiedAttributesList(const CustomVarObject::Ptr& object); - /* notification */ static int GetCheckableNotificationsEnabled(const Checkable::Ptr& checkable); static int GetCheckableNotificationLastNotification(const Checkable::Ptr& checkable); diff --git a/lib/icinga/customvarobject.cpp b/lib/icinga/customvarobject.cpp index a9deaa4f6..267f23297 100644 --- a/lib/icinga/customvarobject.cpp +++ b/lib/icinga/customvarobject.cpp @@ -29,23 +29,6 @@ using namespace icinga; REGISTER_TYPE(CustomVarObject); -int CustomVarObject::GetModifiedAttributes(void) const -{ - //TODO-MA - return 0; -} - -void CustomVarObject::SetModifiedAttributes(int, const MessageOrigin::Ptr&) -{ - //TODO-MA -} - -bool CustomVarObject::IsVarOverridden(const String& name) const -{ - //TODO: implement - return false; -} - void CustomVarObject::ValidateVars(const Dictionary::Ptr& value, const ValidationUtils& utils) { MacroProcessor::ValidateCustomVars(this, value); diff --git a/lib/icinga/customvarobject.hpp b/lib/icinga/customvarobject.hpp index 46dd59d17..fb5e4701a 100644 --- a/lib/icinga/customvarobject.hpp +++ b/lib/icinga/customvarobject.hpp @@ -28,27 +28,6 @@ namespace icinga { -enum ModifiedAttributeType -{ - ModAttrNotificationsEnabled = 1, - ModAttrActiveChecksEnabled = 2, - ModAttrPassiveChecksEnabled = 4, - ModAttrEventHandlerEnabled = 8, - ModAttrFlapDetectionEnabled = 16, - ModAttrFailurePredictionEnabled = 32, - ModAttrPerformanceDataEnabled = 64, - ModAttrObsessiveHandlerEnabled = 128, - ModAttrEventHandlerCommand = 256, - ModAttrCheckCommand = 512, - ModAttrNormalCheckInterval = 1024, - ModAttrRetryCheckInterval = 2048, - ModAttrMaxCheckAttempts = 4096, - ModAttrFreshnessChecksEnabled = 8192, - ModAttrCheckTimeperiod = 16384, - ModAttrCustomVariable = 32768, - ModAttrNotificationTimeperiod = 65536 -}; - /** * An object with custom variable attribute. * @@ -60,11 +39,6 @@ public: DECLARE_OBJECT(CustomVarObject); virtual void ValidateVars(const Dictionary::Ptr& value, const ValidationUtils& utils) override; - - virtual int GetModifiedAttributes(void) const; - virtual void SetModifiedAttributes(int flags, const MessageOrigin::Ptr& origin = MessageOrigin::Ptr()); - - bool IsVarOverridden(const String& name) const; }; } diff --git a/lib/icinga/externalcommandprocessor.cpp b/lib/icinga/externalcommandprocessor.cpp index 6561bc360..bb99d9da2 100644 --- a/lib/icinga/externalcommandprocessor.cpp +++ b/lib/icinga/externalcommandprocessor.cpp @@ -257,12 +257,6 @@ void ExternalCommandProcessor::StaticInitialize(void) RegisterCommand("STOP_EXECUTING_SVC_CHECKS", &ExternalCommandProcessor::StopExecutingSvcChecks); RegisterCommand("START_EXECUTING_HOST_CHECKS", &ExternalCommandProcessor::StartExecutingHostChecks); RegisterCommand("STOP_EXECUTING_HOST_CHECKS", &ExternalCommandProcessor::StopExecutingHostChecks); - RegisterCommand("CHANGE_SVC_MODATTR", &ExternalCommandProcessor::ChangeSvcModattr, 3); - RegisterCommand("CHANGE_HOST_MODATTR", &ExternalCommandProcessor::ChangeHostModattr, 2); - RegisterCommand("CHANGE_USER_MODATTR", &ExternalCommandProcessor::ChangeUserModattr, 2); - RegisterCommand("CHANGE_CHECKCOMMAND_MODATTR", &ExternalCommandProcessor::ChangeCheckcommandModattr, 2); - RegisterCommand("CHANGE_EVENTCOMMAND_MODATTR", &ExternalCommandProcessor::ChangeEventcommandModattr, 2); - RegisterCommand("CHANGE_NOTIFICATIONCOMMAND_MODATTR", &ExternalCommandProcessor::ChangeNotificationcommandModattr, 2); RegisterCommand("CHANGE_NORMAL_SVC_CHECK_INTERVAL", &ExternalCommandProcessor::ChangeNormalSvcCheckInterval, 3); RegisterCommand("CHANGE_NORMAL_HOST_CHECK_INTERVAL", &ExternalCommandProcessor::ChangeNormalHostCheckInterval, 2); RegisterCommand("CHANGE_RETRY_SVC_CHECK_INTERVAL", &ExternalCommandProcessor::ChangeRetrySvcCheckInterval, 3); @@ -1667,89 +1661,6 @@ void ExternalCommandProcessor::StopExecutingHostChecks(double, const std::vector IcingaApplication::GetInstance()->SetEnableHostChecks(false); } -void ExternalCommandProcessor::ChangeSvcModattr(double, const std::vector& arguments) -{ - Service::Ptr service = Service::GetByNamePair(arguments[0], arguments[1]); - - if (!service) - BOOST_THROW_EXCEPTION(std::invalid_argument("Cannot update modified attributes for non-existent service '" + arguments[1] + "' on host '" + arguments[0] + "'")); - - int modifiedAttributes = Convert::ToLong(arguments[2]); - - Log(LogNotice, "ExternalCommandProcessor") - << "Updating modified attributes for service '" << arguments[1] << "'"; - - service->SetModifiedAttributes(modifiedAttributes); -} - -void ExternalCommandProcessor::ChangeHostModattr(double, const std::vector& arguments) -{ - Host::Ptr host = Host::GetByName(arguments[0]); - - if (!host) - BOOST_THROW_EXCEPTION(std::invalid_argument("Cannot update modified attributes for non-existent host '" + arguments[0] + "'")); - - Log(LogNotice, "ExternalCommandProcessor") - << "Updating modified attributes for host '" << arguments[0] << "'"; - - int modifiedAttributes = Convert::ToLong(arguments[1]); - - host->SetModifiedAttributes(modifiedAttributes); -} - -void ExternalCommandProcessor::ChangeUserModattr(double, const std::vector& arguments) -{ - User::Ptr user = User::GetByName(arguments[0]); - - if (!user) - BOOST_THROW_EXCEPTION(std::invalid_argument("Cannot update modified attributes for non-existent user '" + arguments[0] + "'")); - - Log(LogNotice, "ExternalCommandProcessor") - << "Updating modified attributes for user '" << arguments[0] << "'"; - - int modifiedAttributes = Convert::ToLong(arguments[1]); - - user->SetModifiedAttributes(modifiedAttributes); -} - -void ExternalCommandProcessor::ChangeCheckcommandModattr(double, const std::vector& arguments) -{ - CheckCommand::Ptr command = CheckCommand::GetByName(arguments[0]); - - if (!command) - BOOST_THROW_EXCEPTION(std::invalid_argument("Cannot update modified attributes for non-existent command '" + arguments[0] + "'")); - - ChangeCommandModattrInternal(command, Convert::ToLong(arguments[1])); -} - -void ExternalCommandProcessor::ChangeEventcommandModattr(double, const std::vector& arguments) -{ - EventCommand::Ptr command = EventCommand::GetByName(arguments[0]); - - if (!command) - BOOST_THROW_EXCEPTION(std::invalid_argument("Cannot update modified attributes for non-existent command '" + arguments[0] + "'")); - - ChangeCommandModattrInternal(command, Convert::ToLong(arguments[1])); -} - -void ExternalCommandProcessor::ChangeNotificationcommandModattr(double, const std::vector& arguments) -{ - NotificationCommand::Ptr command = NotificationCommand::GetByName(arguments[0]); - - if (!command) - BOOST_THROW_EXCEPTION(std::invalid_argument("Cannot update modified attributes for non-existent command '" + arguments[0] + "'")); - - ChangeCommandModattrInternal(command, Convert::ToLong(arguments[1])); -} - -void ExternalCommandProcessor::ChangeCommandModattrInternal(const Command::Ptr& command, int mod_attr) -{ - Log(LogNotice, "ExternalCommandProcessor") - << "Updating modified attributes for command '" << command->GetName() << "'"; - - command->SetModifiedAttributes(mod_attr); -} - void ExternalCommandProcessor::ChangeNormalSvcCheckInterval(double, const std::vector& arguments) { Service::Ptr service = Service::GetByNamePair(arguments[0], arguments[1]); diff --git a/lib/icinga/externalcommandprocessor.hpp b/lib/icinga/externalcommandprocessor.hpp index 72072bf87..520499888 100644 --- a/lib/icinga/externalcommandprocessor.hpp +++ b/lib/icinga/externalcommandprocessor.hpp @@ -127,13 +127,6 @@ private: static void StopExecutingSvcChecks(double time, const std::vector& arguments); static void StartExecutingHostChecks(double time, const std::vector& arguments); static void StopExecutingHostChecks(double time, const std::vector& arguments); - static void ChangeSvcModattr(double time, const std::vector& arguments); - static void ChangeHostModattr(double time, const std::vector& arguments); - - static void ChangeUserModattr(double time, const std::vector& arguments); - static void ChangeCheckcommandModattr(double time, const std::vector& arguments); - static void ChangeEventcommandModattr(double time, const std::vector& arguments); - static void ChangeNotificationcommandModattr(double time, const std::vector& arguments); static void ChangeNormalSvcCheckInterval(double time, const std::vector& arguments); static void ChangeNormalHostCheckInterval(double time, const std::vector& arguments); @@ -168,7 +161,6 @@ private: static void DisableServicegroupSvcNotifications(double time, const std::vector& arguments); private: - static void ChangeCommandModattrInternal(const Command::Ptr& command, int mod_attr); static void ChangeCustomCommandVarInternal(const Command::Ptr& command, const String& name, const Value& value); }; diff --git a/lib/icinga/user.cpp b/lib/icinga/user.cpp index f8f170495..048109e6c 100644 --- a/lib/icinga/user.cpp +++ b/lib/icinga/user.cpp @@ -119,15 +119,3 @@ void User::ValidateTypes(const Array::Ptr& value, const ValidationUtils& utils) BOOST_THROW_EXCEPTION(ValidationError(this, boost::assign::list_of("types"), "Type filter is invalid.")); } } - -int User::GetModifiedAttributes(void) const -{ - //TODO-MA - return 0; -} - -void User::SetModifiedAttributes(int flags, const MessageOrigin::Ptr& origin) -{ - //TODO-MA - return; -} diff --git a/lib/icinga/user.hpp b/lib/icinga/user.hpp index 40c7a7dc1..e86f71e81 100644 --- a/lib/icinga/user.hpp +++ b/lib/icinga/user.hpp @@ -47,9 +47,6 @@ public: virtual void ValidateStates(const Array::Ptr& value, const ValidationUtils& utils) override; virtual void ValidateTypes(const Array::Ptr& value, const ValidationUtils& utils) override; - virtual int GetModifiedAttributes(void) const override; - virtual void SetModifiedAttributes(int flags, const MessageOrigin::Ptr& origin = MessageOrigin::Ptr()) override; - protected: virtual void Stop(void) override; diff --git a/lib/livestatus/commandstable.cpp b/lib/livestatus/commandstable.cpp index f8e7c133e..1e86ebed7 100644 --- a/lib/livestatus/commandstable.cpp +++ b/lib/livestatus/commandstable.cpp @@ -44,8 +44,8 @@ void CommandsTable::AddColumns(Table *table, const String& prefix, table->AddColumn(prefix + "custom_variable_names", Column(&CommandsTable::CustomVariableNamesAccessor, objectAccessor)); table->AddColumn(prefix + "custom_variable_values", Column(&CommandsTable::CustomVariableValuesAccessor, objectAccessor)); table->AddColumn(prefix + "custom_variables", Column(&CommandsTable::CustomVariablesAccessor, objectAccessor)); - table->AddColumn(prefix + "modified_attributes", Column(&CommandsTable::ModifiedAttributesAccessor, objectAccessor)); - table->AddColumn(prefix + "modified_attributes_list", Column(&CommandsTable::ModifiedAttributesListAccessor, objectAccessor)); + table->AddColumn(prefix + "modified_attributes", Column(&Table::ZeroAccessor, objectAccessor)); + table->AddColumn(prefix + "modified_attributes_list", Column(&Table::ZeroAccessor, objectAccessor)); } String CommandsTable::GetName(void) const @@ -185,24 +185,3 @@ Value CommandsTable::CustomVariablesAccessor(const Value& row) return cv; } - -Value CommandsTable::ModifiedAttributesAccessor(const Value& row) -{ - Command::Ptr command = static_cast(row); - - if (!command) - return Empty; - - /* not supported */ - return command->GetModifiedAttributes(); -} - -Value CommandsTable::ModifiedAttributesListAccessor(const Value& row) -{ - Command::Ptr command = static_cast(row); - - if (!command) - return Empty; - - return CompatUtility::GetModifiedAttributesList(command); -} diff --git a/lib/livestatus/commandstable.hpp b/lib/livestatus/commandstable.hpp index 16ce7193e..789eaa46b 100644 --- a/lib/livestatus/commandstable.hpp +++ b/lib/livestatus/commandstable.hpp @@ -51,8 +51,6 @@ protected: static Value CustomVariableNamesAccessor(const Value& row); static Value CustomVariableValuesAccessor(const Value& row); static Value CustomVariablesAccessor(const Value& row); - static Value ModifiedAttributesAccessor(const Value& row); - static Value ModifiedAttributesListAccessor(const Value& row); }; } diff --git a/lib/livestatus/contactstable.cpp b/lib/livestatus/contactstable.cpp index 490ca5e68..8b36a46c2 100644 --- a/lib/livestatus/contactstable.cpp +++ b/lib/livestatus/contactstable.cpp @@ -52,8 +52,8 @@ void ContactsTable::AddColumns(Table *table, const String& prefix, table->AddColumn(prefix + "vars_variable_names", Column(&ContactsTable::CustomVariableNamesAccessor, objectAccessor)); table->AddColumn(prefix + "vars_variable_values", Column(&ContactsTable::CustomVariableValuesAccessor, objectAccessor)); table->AddColumn(prefix + "vars_variables", Column(&ContactsTable::CustomVariablesAccessor, objectAccessor)); - table->AddColumn(prefix + "modified_attributes", Column(&ContactsTable::ModifiedAttributesAccessor, objectAccessor)); - table->AddColumn(prefix + "modified_attributes_list", Column(&ContactsTable::ModifiedAttributesListAccessor, objectAccessor)); + table->AddColumn(prefix + "modified_attributes", Column(&Table::ZeroAccessor, objectAccessor)); + table->AddColumn(prefix + "modified_attributes_list", Column(&Table::ZeroAccessor, objectAccessor)); table->AddColumn(prefix + "cv_is_json", Column(&ContactsTable::CVIsJsonAccessor, objectAccessor)); } @@ -316,24 +316,3 @@ Value ContactsTable::CVIsJsonAccessor(const Value& row) return cv_is_json; } - -Value ContactsTable::ModifiedAttributesAccessor(const Value& row) -{ - User::Ptr user = static_cast(row); - - if (!user) - return Empty; - - /* not supported */ - return user->GetModifiedAttributes(); -} - -Value ContactsTable::ModifiedAttributesListAccessor(const Value& row) -{ - User::Ptr user = static_cast(row); - - if (!user) - return Empty; - - return CompatUtility::GetModifiedAttributesList(user); -} diff --git a/lib/livestatus/contactstable.hpp b/lib/livestatus/contactstable.hpp index 7bcaa88d5..3aaaab1ec 100644 --- a/lib/livestatus/contactstable.hpp +++ b/lib/livestatus/contactstable.hpp @@ -59,8 +59,6 @@ protected: static Value CustomVariableNamesAccessor(const Value& row); static Value CustomVariableValuesAccessor(const Value& row); static Value CustomVariablesAccessor(const Value& row); - static Value ModifiedAttributesAccessor(const Value& row); - static Value ModifiedAttributesListAccessor(const Value& row); static Value CVIsJsonAccessor(const Value& row); }; diff --git a/lib/livestatus/hoststable.cpp b/lib/livestatus/hoststable.cpp index 02c028d79..cd16f7906 100644 --- a/lib/livestatus/hoststable.cpp +++ b/lib/livestatus/hoststable.cpp @@ -111,8 +111,8 @@ void HostsTable::AddColumns(Table *table, const String& prefix, table->AddColumn(prefix + "active_checks_enabled", Column(&HostsTable::ActiveChecksEnabledAccessor, objectAccessor)); table->AddColumn(prefix + "check_options", Column(&HostsTable::CheckOptionsAccessor, objectAccessor)); table->AddColumn(prefix + "obsess_over_host", Column(&Table::ZeroAccessor, objectAccessor)); - table->AddColumn(prefix + "modified_attributes", Column(&HostsTable::ModifiedAttributesAccessor, objectAccessor)); - table->AddColumn(prefix + "modified_attributes_list", Column(&HostsTable::ModifiedAttributesListAccessor, objectAccessor)); + table->AddColumn(prefix + "modified_attributes", Column(&Table::ZeroAccessor, objectAccessor)); + table->AddColumn(prefix + "modified_attributes_list", Column(&Table::ZeroAccessor, objectAccessor)); table->AddColumn(prefix + "check_interval", Column(&HostsTable::CheckIntervalAccessor, objectAccessor)); table->AddColumn(prefix + "retry_interval", Column(&HostsTable::RetryIntervalAccessor, objectAccessor)); table->AddColumn(prefix + "notification_interval", Column(&HostsTable::NotificationIntervalAccessor, objectAccessor)); @@ -778,26 +778,6 @@ Value HostsTable::CheckOptionsAccessor(const Value&) return Empty; } -Value HostsTable::ModifiedAttributesAccessor(const Value& row) -{ - Host::Ptr host = static_cast(row); - - if (!host) - return Empty; - - return host->GetModifiedAttributes(); -} - -Value HostsTable::ModifiedAttributesListAccessor(const Value& row) -{ - Host::Ptr host = static_cast(row); - - if (!host) - return Empty; - - return CompatUtility::GetModifiedAttributesList(host); -} - Value HostsTable::CheckIntervalAccessor(const Value& row) { Host::Ptr host = static_cast(row); diff --git a/lib/livestatus/hoststable.hpp b/lib/livestatus/hoststable.hpp index ff376e145..884afbb3f 100644 --- a/lib/livestatus/hoststable.hpp +++ b/lib/livestatus/hoststable.hpp @@ -101,8 +101,6 @@ protected: static Value ScheduledDowntimeDepthAccessor(const Value& row); static Value ActiveChecksEnabledAccessor(const Value& row); static Value CheckOptionsAccessor(const Value& row); - static Value ModifiedAttributesAccessor(const Value& row); - static Value ModifiedAttributesListAccessor(const Value& row); static Value CheckIntervalAccessor(const Value& row); static Value RetryIntervalAccessor(const Value& row); static Value NotificationIntervalAccessor(const Value& row); diff --git a/lib/livestatus/servicestable.cpp b/lib/livestatus/servicestable.cpp index 644240a94..32d471933 100644 --- a/lib/livestatus/servicestable.cpp +++ b/lib/livestatus/servicestable.cpp @@ -108,8 +108,8 @@ void ServicesTable::AddColumns(Table *table, const String& prefix, table->AddColumn(prefix + "flap_detection_enabled", Column(&ServicesTable::FlapDetectionEnabledAccessor, objectAccessor)); table->AddColumn(prefix + "check_freshness", Column(&ServicesTable::CheckFreshnessAccessor, objectAccessor)); table->AddColumn(prefix + "obsess_over_service", Column(&Table::ZeroAccessor, objectAccessor)); - table->AddColumn(prefix + "modified_attributes", Column(&ServicesTable::ModifiedAttributesAccessor, objectAccessor)); - table->AddColumn(prefix + "modified_attributes_list", Column(&ServicesTable::ModifiedAttributesListAccessor, objectAccessor)); + table->AddColumn(prefix + "modified_attributes", Column(&Table::ZeroAccessor, objectAccessor)); + table->AddColumn(prefix + "modified_attributes_list", Column(&Table::ZeroAccessor, objectAccessor)); table->AddColumn(prefix + "pnpgraph_present", Column(&Table::ZeroAccessor, objectAccessor)); table->AddColumn(prefix + "staleness", Column(&ServicesTable::StalenessAccessor, objectAccessor)); table->AddColumn(prefix + "check_interval", Column(&ServicesTable::CheckIntervalAccessor, objectAccessor)); @@ -806,26 +806,6 @@ Value ServicesTable::CheckFreshnessAccessor(const Value& row) return CompatUtility::GetCheckableFreshnessChecksEnabled(service); } -Value ServicesTable::ModifiedAttributesAccessor(const Value& row) -{ - Service::Ptr service = static_cast(row); - - if (!service) - return Empty; - - return service->GetModifiedAttributes(); -} - -Value ServicesTable::ModifiedAttributesListAccessor(const Value& row) -{ - Service::Ptr service = static_cast(row); - - if (!service) - return Empty; - - return CompatUtility::GetModifiedAttributesList(service); -} - Value ServicesTable::StalenessAccessor(const Value& row) { Service::Ptr service = static_cast(row); diff --git a/lib/livestatus/servicestable.hpp b/lib/livestatus/servicestable.hpp index 307698dc1..ab8d5fbec 100644 --- a/lib/livestatus/servicestable.hpp +++ b/lib/livestatus/servicestable.hpp @@ -102,8 +102,6 @@ protected: static Value CheckOptionsAccessor(const Value& row); static Value FlapDetectionEnabledAccessor(const Value& row); static Value CheckFreshnessAccessor(const Value& row); - static Value ModifiedAttributesAccessor(const Value& row); - static Value ModifiedAttributesListAccessor(const Value& row); static Value StalenessAccessor(const Value& row); static Value CheckIntervalAccessor(const Value& row); static Value RetryIntervalAccessor(const Value& row);