-
Notifications
You must be signed in to change notification settings - Fork 582
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Icinga DB: dump the correct icinga:config:endpoint#zone_id #8706
Conversation
Before
After
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This just looks really error-prone.
Is there any situation where it would make sense to actually set the zone attribute of an endpoint object to something else than the zone of which the endpoint is a member? Or in other words, can we make ConfigObject::GetZone()
virtual (or set ConfigObject::m_Zone
from Endpoint
) instead?
I've skipped through all uses of GetZone()
and the only other ones I could find that operate on the static type ConfigObject
are the following:
ApiListener::UpdateConfigObject()
:icinga2/lib/remote/apilistener-configsync.cpp
Line 386 in 8dc069d
Zone::Ptr target = static_pointer_cast<Zone>(object->GetZone()); ApiListener::DeleteConfigObject()
:icinga2/lib/remote/apilistener-configsync.cpp
Line 436 in 8dc069d
Zone::Ptr target = static_pointer_cast<Zone>(object->GetZone()); ApiListener::SyncRelayMessage()
:icinga2/lib/remote/apilistener.cpp
Line 1235 in 8dc069d
target_zone = static_pointer_cast<Zone>(secobj->GetZone()); Zone::CanAccessObject()
:Line 98 in 8dc069d
object_zone = static_pointer_cast<Zone>(object->GetZone());
So it should be feasible to look over these if changing the behavior of ConfigObject::GetZone()
for Endpoint
objects would be a problem.
@lippserd What about zone in zone? |
With file-based config sync this shouldn't be an issue as the config is synced based on the directory it is in. Maybe this could create issues with object-based config sync for API-created objects? I.e. if you'd add an Endpoint via the API, it would then be synced down to this endpoint where it yields an error as this already exists (as it has to be configured for the cluster to even connect)? |
I'm not entirely sure what the question is, but since configuring zone(s) in zone(s) is not an issue, Icinga 2 should dump the actual zone of the object, not the zone in which it was defined. Does that answer your question? |
My question: can endpoint objects also be inside zones, i.e. "non-locally"? |
Yes. |
So the Endpoint's Zone getter is actually used to determine the Zone where the Endpoint is defined. @julianbrost So we shall not override the getter's semantics. |
Ok, then we probably need a relationship with two different zones for each endpoint. I think we should then also make this explicit everywhere. With the current state of this PR, Why is the zone information that's currently dumped wrong in the first place? After all it's a zone that has a relationship to the endpoint and it's the same information that's currently returned when querying endpoint objects using the API:
I'd rather add the zone membership information as additional attributes, maybe called something like In the long run (probably not as part of this PR), I'd also rename |
@lippserd Any strong opinion on this? |
It should be the zone where the object is a member of. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ok, then we're switching from the value of the zone attribute as known to Icinga to something the user hopefully expects the zone of an object to be. This should then be documented at some point (probably in some form of schema documentation, but this would fit better into the Icinga DB repo).
No description provided.