From: Gunnar Beutner Date: Fri, 21 Nov 2014 22:23:31 +0000 (+0100) Subject: Fix initialization for the ApiListener class X-Git-Tag: v2.3.0~645 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=8611682cdbf257b59ccf00ee6a3cb358703e3644;p=icinga2 Fix initialization for the ApiListener class fixes #7780 --- diff --git a/lib/remote/apilistener.cpp b/lib/remote/apilistener.cpp index e8578b0d7..807adbf2e 100644 --- a/lib/remote/apilistener.cpp +++ b/lib/remote/apilistener.cpp @@ -80,14 +80,15 @@ void ApiListener::OnConfigLoaded(void) Application::Exit(EXIT_FAILURE); } } +} +void ApiListener::OnAllConfigLoaded(void) +{ if (!Endpoint::GetByName(GetIdentity())) { Log(LogCritical, "ApiListener") << "Endpoint object for '" << GetIdentity() << "' is missing."; Application::Exit(EXIT_FAILURE); } - - SyncZoneDirs(); } /** @@ -95,6 +96,8 @@ void ApiListener::OnConfigLoaded(void) */ void ApiListener::Start(void) { + SyncZoneDirs(); + if (std::distance(DynamicType::GetObjectsByType().first, DynamicType::GetObjectsByType().second) > 1) { Log(LogCritical, "ApiListener", "Only one ApiListener object is allowed."); return; diff --git a/lib/remote/apilistener.hpp b/lib/remote/apilistener.hpp index 5299ed4a0..ed303cb53 100644 --- a/lib/remote/apilistener.hpp +++ b/lib/remote/apilistener.hpp @@ -70,6 +70,7 @@ public: protected: virtual void OnConfigLoaded(void); + virtual void OnAllConfigLoaded(void); virtual void Start(void); private: