]> granicus.if.org Git - icinga2/commitdiff
Bugfix: Delegation didn't work for local-only instances.
authorGunnar Beutner <gunnar.beutner@netways.de>
Fri, 12 Oct 2012 13:45:33 +0000 (15:45 +0200)
committerGunnar Beutner <gunnar.beutner@netways.de>
Fri, 12 Oct 2012 13:45:33 +0000 (15:45 +0200)
components/delegation/delegationcomponent.cpp

index a345ae03834b0d711a8e82e30011c80e61a60063..9e8e85a03e8eec64151daaabf4ee3eed58c5b055 100644 (file)
@@ -44,13 +44,14 @@ vector<Endpoint::Ptr> DelegationComponent::GetCheckerCandidates(const Service::P
        BOOST_FOREACH(tie(tuples::ignore, object), DynamicObject::GetObjects("Endpoint")) {
                Endpoint::Ptr endpoint = dynamic_pointer_cast<Endpoint>(object);
 
-               /* ignore local-only endpoints */
-               if (endpoint->IsLocal())
+               String myIdentity = EndpointManager::GetInstance()->GetIdentity();
+
+               /* ignore local-only endpoints (unless this is a local-only instance) */
+               if (endpoint->IsLocal() && !myIdentity.IsEmpty())
                        continue;
 
                /* ignore disconnected endpoints */
-               if (!endpoint->IsConnected() &&
-                   endpoint->GetName() != EndpointManager::GetInstance()->GetIdentity())
+               if (!endpoint->IsConnected() && endpoint->GetName() != myIdentity)
                        continue;
 
                /* ignore endpoints that aren't running the checker component */
@@ -75,9 +76,6 @@ void DelegationComponent::DelegationTimerHandler(void)
        BOOST_FOREACH(tie(tuples::ignore, object), DynamicObject::GetObjects("Endpoint")) {
                Endpoint::Ptr endpoint = dynamic_pointer_cast<Endpoint>(object);
 
-               if (endpoint->IsLocal())
-                       continue;
-
                histogram[endpoint] = 0;
        }