Observe new bind client attached
This commit is contained in:
parent
affc0436fa
commit
1b42ad3265
@ -85,12 +85,21 @@ class BindRndcProvidesRelationHandler(sunbeam_rhandlers.RelationHandler):
|
|||||||
def setup_event_handler(self) -> ops.Object:
|
def setup_event_handler(self) -> ops.Object:
|
||||||
"""Setup event handler for the relation."""
|
"""Setup event handler for the relation."""
|
||||||
interface = bind_rndc.BindRndcProvides(self.charm, BIND_RNDC_RELATION)
|
interface = bind_rndc.BindRndcProvides(self.charm, BIND_RNDC_RELATION)
|
||||||
|
self.framework.observe(
|
||||||
|
interface.on.new_bind_client_attached,
|
||||||
|
self._on_bind_client_attached,
|
||||||
|
)
|
||||||
self.framework.observe(
|
self.framework.observe(
|
||||||
interface.on.bind_client_updated,
|
interface.on.bind_client_updated,
|
||||||
self._on_bind_client_updated,
|
self._on_bind_client_updated,
|
||||||
)
|
)
|
||||||
return interface
|
return interface
|
||||||
|
|
||||||
|
def _on_bind_client_attached(self, event: bind_rndc.NewBindClientAttachedEvent):
|
||||||
|
"""Handle bind client attached event."""
|
||||||
|
self.refresh_address()
|
||||||
|
self.callback_f(event)
|
||||||
|
|
||||||
def _on_bind_client_updated(self, event: bind_rndc.BindClientUpdatedEvent):
|
def _on_bind_client_updated(self, event: bind_rndc.BindClientUpdatedEvent):
|
||||||
"""Handle bind client updated event."""
|
"""Handle bind client updated event."""
|
||||||
self.refresh_address()
|
self.refresh_address()
|
||||||
|
Loading…
x
Reference in New Issue
Block a user