Skip to content

Commit a65f2d6

Browse files
authored
Merge pull request #10417 from Icinga/inverted-hacluster-check
Fix inverted `IsHACluster` check
2 parents 235a3e1 + 1da497b commit a65f2d6

File tree

3 files changed

+5
-9
lines changed

3 files changed

+5
-9
lines changed

lib/remote/apilistener.cpp

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1927,11 +1927,7 @@ void ApiListener::ValidateTlsHandshakeTimeout(const Lazy<double>& lvalue, const
19271927
bool ApiListener::IsHACluster()
19281928
{
19291929
Zone::Ptr zone = Zone::GetLocalZone();
1930-
1931-
if (!zone)
1932-
return false;
1933-
1934-
return zone->IsSingleInstance();
1930+
return zone && zone->IsHACluster();
19351931
}
19361932

19371933
/* Provide a helper function for zone origin name. */

lib/remote/zone.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -125,10 +125,10 @@ bool Zone::IsGlobal() const
125125
return GetGlobal();
126126
}
127127

128-
bool Zone::IsSingleInstance() const
128+
bool Zone::IsHACluster() const
129129
{
130-
Array::Ptr endpoints = GetEndpointsRaw();
131-
return !endpoints || endpoints->GetLength() < 2;
130+
auto endpoints = GetEndpointsRaw();
131+
return endpoints && endpoints->GetLength() >= 2;
132132
}
133133

134134
Zone::Ptr Zone::GetLocalZone()

lib/remote/zone.hpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ class Zone final : public ObjectImpl<Zone>
2929
bool CanAccessObject(const ConfigObject::Ptr& object);
3030
bool IsChildOf(const Zone::Ptr& zone);
3131
bool IsGlobal() const;
32-
bool IsSingleInstance() const;
32+
bool IsHACluster() const;
3333

3434
static Zone::Ptr GetLocalZone();
3535

0 commit comments

Comments
 (0)