From df79e4c2dc97ca58a28c59f899d9af53b8acc6b7 Mon Sep 17 00:00:00 2001 From: Gunnar Beutner Date: Sat, 16 Feb 2013 11:28:16 +0100 Subject: [PATCH] Remove method validator. --- itl/types.conf | 3 --- lib/config/configtype.cpp | 30 ------------------------------ lib/config/configtype.h | 3 --- 3 files changed, 36 deletions(-) diff --git a/itl/types.conf b/itl/types.conf index bd595934c..9f3956897 100644 --- a/itl/types.conf +++ b/itl/types.conf @@ -31,9 +31,6 @@ type DynamicObject { %attribute string "__type", %attribute dictionary "methods" { - %validator "ValidateMethods", - - %attribute string "*", }, %attribute any "custom::*" diff --git a/lib/config/configtype.cpp b/lib/config/configtype.cpp index a48296458..9fba1d09d 100644 --- a/lib/config/configtype.cpp +++ b/lib/config/configtype.cpp @@ -21,8 +21,6 @@ using namespace icinga; -REGISTER_SCRIPTFUNCTION("ValidateMethods", &ConfigType::ValidateMethods); - ConfigType::ConfigType(const String& name, const DebugInfo& debuginfo) : m_Name(name), m_RuleList(boost::make_shared()), m_DebugInfo(debuginfo) { } @@ -171,31 +169,3 @@ void ConfigType::ValidateDictionary(const Dictionary::Ptr& dictionary, } } -void ConfigType::ValidateMethods(const ScriptTask::Ptr& task, - const vector& arguments) -{ - if (arguments.size() < 1) - BOOST_THROW_EXCEPTION(invalid_argument("Missing argument: Location must be specified.")); - - if (arguments.size() < 2) - BOOST_THROW_EXCEPTION(invalid_argument("Missing argument: Attribute dictionary must be specified.")); - - String location = arguments[0]; - Dictionary::Ptr attrs = arguments[1]; - - String key; - Value value; - BOOST_FOREACH(tie(key, value), attrs) { - if (!value.IsScalar()) - continue; - - String method = value; - - if (!ScriptFunction::GetByName(method)) { - ConfigCompilerContext::GetContext()->AddError(false, "Validation failed for " + - location + ": Script function '" + method + "' not found."); - } - } - - task->FinishResult(Empty); -} diff --git a/lib/config/configtype.h b/lib/config/configtype.h index b72aeaaa9..4251a5f3d 100644 --- a/lib/config/configtype.h +++ b/lib/config/configtype.h @@ -46,9 +46,6 @@ public: void ValidateItem(const ConfigItem::Ptr& object) const; - static void ValidateMethods(const ScriptTask::Ptr& task, - const vector& arguments); - private: String m_Name; /**< The type name. */ String m_Parent; /**< The parent type. */ -- 2.40.0