Update status on remove relation
Handle the events when relation is removed and update the status accordingly. In this patch ovsdb-cms is handled. Change-Id: If239ddbfa729a6fa763d1f9bc73e18142ac24a2b
This commit is contained in:
@@ -27,6 +27,9 @@ from typing import (
|
||||
|
||||
import ops.charm
|
||||
import ops.framework
|
||||
from ops.model import (
|
||||
BlockedStatus,
|
||||
)
|
||||
|
||||
from .. import relation_handlers as sunbeam_rhandlers
|
||||
|
||||
@@ -475,12 +478,23 @@ class OVSDBCMSRequiresHandler(
|
||||
self.framework.observe(
|
||||
ovsdb_svc.on.ready, self._on_ovsdb_service_ready
|
||||
)
|
||||
self.framework.observe(
|
||||
ovsdb_svc.on.goneaway, self._on_ovsdb_service_goneaway
|
||||
)
|
||||
return ovsdb_svc
|
||||
|
||||
def _on_ovsdb_service_ready(self, event: ops.framework.EventBase) -> None:
|
||||
"""Handle OVSDB CMS change events."""
|
||||
self.callback_f(event)
|
||||
|
||||
def _on_ovsdb_service_goneaway(
|
||||
self, event: ops.framework.EventBase
|
||||
) -> None:
|
||||
"""Handle OVSDB CMS change events."""
|
||||
self.callback_f(event)
|
||||
if self.mandatory:
|
||||
self.status.set(BlockedStatus("integration missing"))
|
||||
|
||||
@property
|
||||
def ready(self) -> bool:
|
||||
"""Whether the interface is ready."""
|
||||
|
Reference in New Issue
Block a user