From 2a9ac26338596f2063644ff065ca5ad9e50f2383 Mon Sep 17 00:00:00 2001 From: Jean Flach Date: Tue, 25 Aug 2015 17:06:08 +0200 Subject: [PATCH] Move endpoint error check to ti file refs #9623 --- lib/remote/endpoint.cpp | 8 -------- lib/remote/endpoint.hpp | 1 - lib/remote/endpoint.ti | 2 +- 3 files changed, 1 insertion(+), 10 deletions(-) diff --git a/lib/remote/endpoint.cpp b/lib/remote/endpoint.cpp index bdbfed088..29068ac0d 100644 --- a/lib/remote/endpoint.cpp +++ b/lib/remote/endpoint.cpp @@ -57,14 +57,6 @@ void Endpoint::OnAllConfigLoaded(void) BOOST_THROW_EXCEPTION(ScriptError("Endpoint '" + GetName() + "' does not belong to a zone.", GetDebugInfo())); } -void Endpoint::ValidatePort(const String& value, const ValidationUtils& utils) -{ - ObjectImpl::ValidatePort(value, utils); - - if (value.IsEmpty()) - BOOST_THROW_EXCEPTION(ValidationError(this, boost::assign::list_of("enpoint_port"), "Port may not be empty.")); -} - void Endpoint::AddClient(const JsonRpcConnection::Ptr& client) { bool was_master = ApiListener::GetInstance()->IsMaster(); diff --git a/lib/remote/endpoint.hpp b/lib/remote/endpoint.hpp index cd8aac117..0738572fe 100644 --- a/lib/remote/endpoint.hpp +++ b/lib/remote/endpoint.hpp @@ -56,7 +56,6 @@ public: protected: virtual void OnAllConfigLoaded(void) override; - virtual void ValidatePort(const String& value, const ValidationUtils& utils) override; private: mutable boost::mutex m_ClientsLock; diff --git a/lib/remote/endpoint.ti b/lib/remote/endpoint.ti index 9625d9b66..eab3fb739 100644 --- a/lib/remote/endpoint.ti +++ b/lib/remote/endpoint.ti @@ -27,7 +27,7 @@ namespace icinga class Endpoint : ConfigObject { [config] String host; - [config] String port { + [config, required] String port { default {{{ return "5665"; }}} }; [config] double log_duration {