Merge pull request #49 from openstack-charmers/add-ovn-base-charm

Add ovn base charm
This commit is contained in:
Liam Young 2022-02-04 08:53:59 +00:00 committed by GitHub
commit 16808d52f8
2 changed files with 36 additions and 5 deletions

View File

@ -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]:

View File

@ -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