from ops.charm import CharmBase
from ops.framework import StoredState
from ops.main import main
-from ops.model import ActiveStatus, Container
+from ops.model import ActiveStatus, BlockedStatus, Container
SERVICE_PORT = 80
logger.debug(e.message)
self.unit.status = e.status
- def _on_required_relation_broken(self, _) -> None:
- """Handler for the kafka-broken event."""
+ def _on_nbi_relation_broken(self, _) -> None:
+ """Handler for the nbi relation broken event."""
# Check Pebble has started in the container
try:
check_container_ready(self.container)
except CharmError:
pass
finally:
- self._on_update_status()
+ self.unit.status = BlockedStatus("need nbi relation")
# ---------------------------------------------------------------------------
# Validation and configuration and more
self.on.update_status: self._on_update_status,
# Relation events
self.on["nbi"].relation_changed: self._on_config_changed,
- self.on["nbi"].relation_broken: self._on_required_relation_broken,
+ self.on["nbi"].relation_broken: self._on_nbi_relation_broken,
}
for event, handler in event_handler_mapping.items():
self.framework.observe(event, handler)