]> granicus.if.org Git - icinga2/commitdiff
Always update object authority, even w/o API feature
authorMichael Friedrich <michael.friedrich@icinga.com>
Wed, 3 Apr 2019 11:48:24 +0000 (13:48 +0200)
committerMichael Friedrich <michael.friedrich@icinga.com>
Wed, 3 Apr 2019 11:48:24 +0000 (13:48 +0200)
Regression from #7062

Thanks @nilmerg :)

lib/remote/apilistener-authority.cpp

index 23f571119afa49b9535d15bc95070339df6d016f..f3740dec530682bd10b52c0e07b60eabf1231959 100644 (file)
@@ -10,13 +10,14 @@ using namespace icinga;
 
 void ApiListener::UpdateObjectAuthority()
 {
-       ApiListener::Ptr instance = ApiListener::GetInstance();
-
-       if (!instance)
-               return;
-
-       Log(LogNotice, "ApiListener")
-               << "Updating object authority for objects at endpoint '" << instance->GetIdentity() << "'.";
+       /* Always run this, even if there is no 'api' feature enabled. */
+       if (auto listener = ApiListener::GetInstance()) {
+               Log(LogNotice, "ApiListener")
+                       << "Updating object authority for objects at endpoint '" << listener->GetIdentity() << "'.";
+       } else {
+               Log(LogNotice, "ApiListener")
+                       << "Updating object authority for local objects.";
+       }
 
        Zone::Ptr my_zone = Zone::GetLocalZone();