]> granicus.if.org Git - icinga2/commitdiff
Add config error on empty port in Endpoints
authorJean Flach <jean-marcel.flach@netways.de>
Mon, 24 Aug 2015 15:19:12 +0000 (17:19 +0200)
committerJean Flach <jean-marcel.flach@netways.de>
Tue, 25 Aug 2015 14:43:52 +0000 (16:43 +0200)
fixes #9623

Conflicts:
lib/remote/endpoint.cpp
lib/remote/endpoint.hpp

lib/remote/endpoint.cpp
lib/remote/endpoint.hpp

index a7a9e7afe6d246a2f749a524cef84064980f6e67..9332aa9226f74f4c3d2bce44df835ab492b78210 100644 (file)
@@ -56,6 +56,14 @@ 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<Endpoint>::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 ApiClient::Ptr& client)
 {
        bool was_master = ApiListener::GetInstance()->IsMaster();
index 3411b32aa1b643694b46540b63008f8f77c8505e..f2dd732758af8013b4d31ad13a181c8978615c63 100644 (file)
@@ -56,6 +56,7 @@ public:
 
 protected:
        virtual void OnAllConfigLoaded(void);
+       virtual void ValidatePort(const String& value, const ValidationUtils& utils) override;
 
 private:
        mutable boost::mutex m_ClientsLock;