From 1da497be89db7d8603ff8da3543200eda4092dcd Mon Sep 17 00:00:00 2001 From: Yonas Habteab Date: Wed, 23 Apr 2025 12:06:26 +0200 Subject: [PATCH] Fix inverted `IsHACluster` check --- lib/remote/apilistener.cpp | 6 +----- lib/remote/zone.cpp | 6 +++--- lib/remote/zone.hpp | 2 +- 3 files changed, 5 insertions(+), 9 deletions(-) diff --git a/lib/remote/apilistener.cpp b/lib/remote/apilistener.cpp index 6bcf5bb5f..db024c987 100644 --- a/lib/remote/apilistener.cpp +++ b/lib/remote/apilistener.cpp @@ -1927,11 +1927,7 @@ void ApiListener::ValidateTlsHandshakeTimeout(const Lazy& lvalue, const bool ApiListener::IsHACluster() { Zone::Ptr zone = Zone::GetLocalZone(); - - if (!zone) - return false; - - return zone->IsSingleInstance(); + return zone && zone->IsHACluster(); } /* Provide a helper function for zone origin name. */ diff --git a/lib/remote/zone.cpp b/lib/remote/zone.cpp index 5ae1468c1..16e4ba367 100644 --- a/lib/remote/zone.cpp +++ b/lib/remote/zone.cpp @@ -125,10 +125,10 @@ bool Zone::IsGlobal() const return GetGlobal(); } -bool Zone::IsSingleInstance() const +bool Zone::IsHACluster() const { - Array::Ptr endpoints = GetEndpointsRaw(); - return !endpoints || endpoints->GetLength() < 2; + auto endpoints = GetEndpointsRaw(); + return endpoints && endpoints->GetLength() >= 2; } Zone::Ptr Zone::GetLocalZone() diff --git a/lib/remote/zone.hpp b/lib/remote/zone.hpp index 897b18e96..26b50dcf9 100644 --- a/lib/remote/zone.hpp +++ b/lib/remote/zone.hpp @@ -29,7 +29,7 @@ public: bool CanAccessObject(const ConfigObject::Ptr& object); bool IsChildOf(const Zone::Ptr& zone); bool IsGlobal() const; - bool IsSingleInstance() const; + bool IsHACluster() const; static Zone::Ptr GetLocalZone();