From 1cf33168ff0184f0b15158301b4c9488d2b47b0d Mon Sep 17 00:00:00 2001 From: Guillaume Boutry Date: Wed, 6 Dec 2023 13:45:10 +0100 Subject: [PATCH] Reference ops.Object from its definition package ops's Object is defined in the framework package. The charm package is only a user. Change-Id: I3683f30fed9cda28b25efce21c40beaf447e1fca --- charms/ceilometer-k8s/src/charm.py | 2 +- charms/heat-k8s/src/charm.py | 2 +- charms/keystone-k8s/src/charm.py | 2 +- ops-sunbeam/doc/howto-relation-handler.rst | 2 +- ops-sunbeam/ops_sunbeam/container_handlers.py | 2 +- .../ops_sunbeam/ovn/relation_handlers.py | 4 ++-- ops-sunbeam/ops_sunbeam/relation_handlers.py | 20 +++++++++---------- 7 files changed, 17 insertions(+), 17 deletions(-) diff --git a/charms/ceilometer-k8s/src/charm.py b/charms/ceilometer-k8s/src/charm.py index 3499d37f..76b4174f 100755 --- a/charms/ceilometer-k8s/src/charm.py +++ b/charms/ceilometer-k8s/src/charm.py @@ -83,7 +83,7 @@ class GnocchiServiceRequiresHandler(sunbeam_rhandlers.RelationHandler): """ super().__init__(charm, relation_name, callback_f, mandatory) - def setup_event_handler(self) -> ops.charm.Object: + def setup_event_handler(self) -> ops.framework.Object: """Configure event handlers for Gnocchi service relation.""" logger.debug("Setting up Gnocchi service event handler") svc = GnocchiServiceRequires( diff --git a/charms/heat-k8s/src/charm.py b/charms/heat-k8s/src/charm.py index 08a131d9..625595e3 100755 --- a/charms/heat-k8s/src/charm.py +++ b/charms/heat-k8s/src/charm.py @@ -73,7 +73,7 @@ class TraefikRouteHandler(sunbeam_rhandlers.RelationHandler): """Run constructor.""" super().__init__(charm, relation_name, callback_f, mandatory) - def setup_event_handler(self) -> ops.charm.Object: + def setup_event_handler(self) -> ops.framework.Object: """Configure event handlers for an Ingress relation.""" logger.debug("Setting up ingress event handler") from charms.traefik_route_k8s.v0.traefik_route import ( diff --git a/charms/keystone-k8s/src/charm.py b/charms/keystone-k8s/src/charm.py index 9a65ddc2..3cbe79e3 100755 --- a/charms/keystone-k8s/src/charm.py +++ b/charms/keystone-k8s/src/charm.py @@ -188,7 +188,7 @@ class DomainConfigHandler(sunbeam_rhandlers.RelationHandler): ): super().__init__(charm, relation_name, callback_f) - def setup_event_handler(self) -> ops.charm.Object: + def setup_event_handler(self) -> ops.framework.Object: """Configure event handlers for an Identity service relation.""" logger.debug("Setting up Identity Service event handler") self.dc = sunbeam_dc_svc.DomainConfigRequires( diff --git a/ops-sunbeam/doc/howto-relation-handler.rst b/ops-sunbeam/doc/howto-relation-handler.rst index 68b057ef..4944b8c6 100644 --- a/ops-sunbeam/doc/howto-relation-handler.rst +++ b/ops-sunbeam/doc/howto-relation-handler.rst @@ -34,7 +34,7 @@ an observer for relation changed events. .. code:: python - def setup_event_handler(self) -> ops.charm.Object: + def setup_event_handler(self) -> ops.framework.Object: """Configure event handlers for a MySQL relation.""" logger.debug("Setting up DB event handler") # Lazy import to ensure this lib is only required if the charm diff --git a/ops-sunbeam/ops_sunbeam/container_handlers.py b/ops-sunbeam/ops_sunbeam/container_handlers.py index 1d9e3437..f8642318 100644 --- a/ops-sunbeam/ops_sunbeam/container_handlers.py +++ b/ops-sunbeam/ops_sunbeam/container_handlers.py @@ -48,7 +48,7 @@ ContainerDir = collections.namedtuple( ) -class PebbleHandler(ops.charm.Object): +class PebbleHandler(ops.framework.Object): """Base handler for Pebble based containers.""" def __init__( diff --git a/ops-sunbeam/ops_sunbeam/ovn/relation_handlers.py b/ops-sunbeam/ops_sunbeam/ovn/relation_handlers.py index 7e2965f5..b9028116 100644 --- a/ops-sunbeam/ops_sunbeam/ovn/relation_handlers.py +++ b/ops-sunbeam/ops_sunbeam/ovn/relation_handlers.py @@ -474,7 +474,7 @@ class OVSDBCMSProvidesHandler( super().__init__(charm, relation_name, callback_f, mandatory) self._update_address_data() - def setup_event_handler(self) -> ops.charm.Object: + def setup_event_handler(self) -> ops.framework.Object: """Configure event handlers for an Identity service relation.""" # Lazy import to ensure this lib is only required if the charm # has this relation. @@ -525,7 +525,7 @@ class OVSDBCMSRequiresHandler( """Run constructor.""" super().__init__(charm, relation_name, callback_f, mandatory) - def setup_event_handler(self) -> ops.charm.Object: + def setup_event_handler(self) -> ops.framework.Object: """Configure event handlers for an Identity service relation.""" # Lazy import to ensure this lib is only required if the charm # has this relation. diff --git a/ops-sunbeam/ops_sunbeam/relation_handlers.py b/ops-sunbeam/ops_sunbeam/relation_handlers.py index dd55ee6b..9acea780 100644 --- a/ops-sunbeam/ops_sunbeam/relation_handlers.py +++ b/ops-sunbeam/ops_sunbeam/relation_handlers.py @@ -51,7 +51,7 @@ ERASURE_CODED = "erasure-coded" REPLICATED = "replicated" -class RelationHandler(ops.charm.Object): +class RelationHandler(ops.framework.Object): """Base handler class for relations. A relation handler is used to manage a charms interaction with a relation @@ -105,7 +105,7 @@ class RelationHandler(ops.charm.Object): else: status.set(WaitingStatus("integration incomplete")) - def setup_event_handler(self) -> ops.charm.Object: + def setup_event_handler(self) -> ops.framework.Object: """Configure event handlers for the relation. This method must be overridden in concrete class @@ -113,7 +113,7 @@ class RelationHandler(ops.charm.Object): """ raise NotImplementedError - def get_interface(self) -> Tuple[ops.charm.Object, str]: + def get_interface(self) -> Tuple[ops.framework.Object, str]: """Return the interface that this handler encapsulates. This is a combination of the interface object and the @@ -166,7 +166,7 @@ class IngressHandler(RelationHandler): self.service_name = service_name super().__init__(charm, relation_name, callback_f, mandatory) - def setup_event_handler(self) -> ops.charm.Object: + def setup_event_handler(self) -> ops.framework.Object: """Configure event handlers for an Ingress relation.""" logger.debug("Setting up ingress event handler") from charms.traefik_k8s.v2.ingress import ( @@ -269,7 +269,7 @@ class DBHandler(RelationHandler): self.database_name = database super().__init__(charm, relation_name, callback_f, mandatory) - def setup_event_handler(self) -> ops.charm.Object: + def setup_event_handler(self) -> ops.framework.Object: """Configure event handlers for a MySQL relation.""" logger.debug("Setting up DB event handler") # Import here to avoid import errors if ops_sunbeam is being used @@ -404,7 +404,7 @@ class RabbitMQHandler(RelationHandler): self.vhost = vhost super().__init__(charm, relation_name, callback_f, mandatory) - def setup_event_handler(self) -> ops.charm.Object: + def setup_event_handler(self) -> ops.framework.Object: """Configure event handlers for an AMQP relation.""" logger.debug("Setting up AMQP event handler") # Lazy import to ensure this lib is only required if the charm @@ -495,7 +495,7 @@ class IdentityServiceRequiresHandler(RelationHandler): self.region = region super().__init__(charm, relation_name, callback_f, mandatory) - def setup_event_handler(self) -> ops.charm.Object: + def setup_event_handler(self) -> ops.framework.Object: """Configure event handlers for an Identity service relation.""" logger.debug("Setting up Identity Service event handler") import charms.keystone_k8s.v1.identity_service as sun_id @@ -654,7 +654,7 @@ class CephClientHandler(RelationHandler): self.app_name = app_name super().__init__(charm, relation_name, callback_f, mandatory) - def setup_event_handler(self) -> ops.charm.Object: + def setup_event_handler(self) -> ops.framework.Object: """Configure event handlers for an ceph-client interface.""" logger.debug("Setting up ceph-client event handler") # Lazy import to ensure this lib is only required if the charm @@ -1099,7 +1099,7 @@ class IdentityCredentialsRequiresHandler(RelationHandler): """ super().__init__(charm, relation_name, callback_f, mandatory) - def setup_event_handler(self) -> ops.charm.Object: + def setup_event_handler(self) -> ops.framework.Object: """Configure event handlers for identity-credentials relation.""" import charms.keystone_k8s.v0.identity_credentials as identity_credentials @@ -1306,7 +1306,7 @@ class CephAccessRequiresHandler(RelationHandler): """ super().__init__(charm, relation_name, callback_f, mandatory) - def setup_event_handler(self) -> ops.charm.Object: + def setup_event_handler(self) -> ops.framework.Object: """Configure event handlers for ceph-access relation.""" import charms.cinder_ceph_k8s.v0.ceph_access as ceph_access