icinga2 icon indicating copy to clipboard operation
icinga2 copied to clipboard

Remove ambiguity between ConfigObject::GetZone() and Endpoint::GetZone()

Open julianbrost opened this issue 4 years ago • 2 comments

Currently, there exist both ConfigObject::GetZone() and Endpoint::GetZone(). As Endpoint inherits from ConfigObject, it is shadowed but both are non-virtual and behave differently:

  • ConfigObject::GetZone() returns the zone that the object is configured within and is relevant for the config sync.
  • Endpoint::GetZone() returns the zone that endpoint is a member of (as configured in the endoints attribute of a zone) which is relevant for cluster routing.

This leads to confusing code where GetZone() of the same object behaves differently depending on its static type: https://github.com/Icinga/icinga2/blob/7f5225ecaa2ddf6a483f1c1f36e83b251ca1276f/lib/icingadb/icingadb-objects.cpp#L1094-L1098

Also, when discussing it internally, it was quite hard to refer to both of these zone relationships so we should come up with better and more distinctive naming.

julianbrost avatar Apr 26 '21 09:04 julianbrost

Hi! I am in an intro to swe class that is requiring me to work on my first open-source project. I was wondering if this issue is still open and if so could is this beginner-friendly?

Ishvina avatar Jan 20 '22 17:01 Ishvina

Hi, thanks for your interest in contributing. This issue is still open and the resulting fix won't need any major code changes, however, the issue requires a good understanding of Icinga 2 and especially its cluster functionality to come up with a meaningful new suggestion for naming things.

julianbrost avatar Jan 26 '22 10:01 julianbrost

What about GetEndpointZone() for referring to the zone of specifically the endpoint?

Al2Klimov avatar Jun 12 '23 14:06 Al2Klimov