From 294e26135cbcbbe2d3c1eb37d5c12de92cac9de6 Mon Sep 17 00:00:00 2001 From: Liam Young Date: Fri, 31 Mar 2023 13:13:06 +0000 Subject: [PATCH] Add relation handler for ovsdb-cms-relay ovsdb-cms-relay was missing a relation handler so was not responding to clients. Change-Id: I7d0319ba1f17acdc3ea0216ce4e381e145dc0f3d --- charmcraft.yaml | 1 + src/charm.py | 18 ++++++++++++++++++ 2 files changed, 19 insertions(+) diff --git a/charmcraft.yaml b/charmcraft.yaml index e2bf865..17a923a 100644 --- a/charmcraft.yaml +++ b/charmcraft.yaml @@ -22,5 +22,6 @@ parts: - git - libffi-dev - libssl-dev + - pkg-config - rustc - cargo diff --git a/src/charm.py b/src/charm.py index cebd1e9..15ee6c4 100755 --- a/src/charm.py +++ b/src/charm.py @@ -40,6 +40,8 @@ import ops_sunbeam.core as sunbeam_core import ops_sunbeam.ovn.charm as ovn_charm import ops_sunbeam.ovn.config_contexts as ovn_ctxts import ops_sunbeam.ovn.container_handlers as ovn_chandlers +import ops_sunbeam.ovn.relation_handlers as ovn_relation_handlers +import ops_sunbeam.relation_handlers as sunbeam_rhandlers from charms.observability_libs.v0.kubernetes_service_patch import ( KubernetesServicePatch, ) @@ -105,6 +107,22 @@ class OVNRelayOperatorCharm(ovn_charm.OSBaseOVNOperatorCharm): self._get_southbound_db_url_action, ) + def get_relation_handlers( + self, handlers: List[sunbeam_rhandlers.RelationHandler] = None + ) -> List[sunbeam_rhandlers.RelationHandler]: + """Relation handlers for the service.""" + handlers = handlers or [] + self.ovsdb_cms = ovn_relation_handlers.OVSDBCMSRequiresHandler( + self, "ovsdb-cms", self.configure_charm, True + ) + handlers.append(self.ovsdb_cms) + self.ovsdb_cms_relay = ovn_relation_handlers.OVSDBCMSProvidesHandler( + self, "ovsdb-cms-relay", self.configure_charm, False + ) + handlers.append(self.ovsdb_cms_relay) + handlers = super().get_relation_handlers(handlers) + return handlers + def _get_southbound_db_url_action(self, event): event.set_results({"url": self.southbound_db_url})