diff --git a/ops-sunbeam/advanced_sunbeam_openstack/charm.py b/ops-sunbeam/advanced_sunbeam_openstack/charm.py index bf2d8bb1..036418f1 100644 --- a/ops-sunbeam/advanced_sunbeam_openstack/charm.py +++ b/ops-sunbeam/advanced_sunbeam_openstack/charm.py @@ -125,11 +125,6 @@ class OSBaseOperatorCharm(ops.charm.CharmBase): self, "certificates", self.configure_charm, self.get_sans(), ) handlers.append(self.certs) - if self.can_add_handler("ovsdb-cms", handlers): - self.certs = sunbeam_rhandlers.OVSDBCMSRequiresHandler( - self, "ovsdb-cms", self.configure_charm, - ) - handlers.append(self.certs) return handlers def get_sans(self) -> List[str]: diff --git a/ops-sunbeam/advanced_sunbeam_openstack/ovn/charm.py b/ops-sunbeam/advanced_sunbeam_openstack/ovn/charm.py new file mode 100644 index 00000000..34af3f3d --- /dev/null +++ b/ops-sunbeam/advanced_sunbeam_openstack/ovn/charm.py @@ -0,0 +1,36 @@ +# Copyright 2022 Canonical Ltd. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +"""Base classes for defining an OVN charm using the Operator framework.""" + +import ops.charm +from typing import List + +from .. import relation_handlers as sunbeam_rhandlers + + +class OSBaseOVNOperatorCharm(ops.charm.CharmBase): + """Base charms for OpenStack operators.""" + + def get_relation_handlers( + self, handlers: List[sunbeam_rhandlers.RelationHandler] = None + ) -> List[sunbeam_rhandlers.RelationHandler]: + """Relation handlers for the service.""" + handlers = handlers or [] + if self.can_add_handler("ovsdb-cms", handlers): + self.ovsdb_cms = sunbeam_rhandlers.OVSDBCMSRequiresHandler( + self, "ovsdb-cms", self.configure_charm, + ) + handlers.append(self.ovsdb_cms) + return handlers