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
This commit is contained in:
parent
b2ee00f44c
commit
1cf33168ff
@ -83,7 +83,7 @@ class GnocchiServiceRequiresHandler(sunbeam_rhandlers.RelationHandler):
|
|||||||
"""
|
"""
|
||||||
super().__init__(charm, relation_name, callback_f, mandatory)
|
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."""
|
"""Configure event handlers for Gnocchi service relation."""
|
||||||
logger.debug("Setting up Gnocchi service event handler")
|
logger.debug("Setting up Gnocchi service event handler")
|
||||||
svc = GnocchiServiceRequires(
|
svc = GnocchiServiceRequires(
|
||||||
|
@ -73,7 +73,7 @@ class TraefikRouteHandler(sunbeam_rhandlers.RelationHandler):
|
|||||||
"""Run constructor."""
|
"""Run constructor."""
|
||||||
super().__init__(charm, relation_name, callback_f, mandatory)
|
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."""
|
"""Configure event handlers for an Ingress relation."""
|
||||||
logger.debug("Setting up ingress event handler")
|
logger.debug("Setting up ingress event handler")
|
||||||
from charms.traefik_route_k8s.v0.traefik_route import (
|
from charms.traefik_route_k8s.v0.traefik_route import (
|
||||||
|
@ -188,7 +188,7 @@ class DomainConfigHandler(sunbeam_rhandlers.RelationHandler):
|
|||||||
):
|
):
|
||||||
super().__init__(charm, relation_name, callback_f)
|
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."""
|
"""Configure event handlers for an Identity service relation."""
|
||||||
logger.debug("Setting up Identity Service event handler")
|
logger.debug("Setting up Identity Service event handler")
|
||||||
self.dc = sunbeam_dc_svc.DomainConfigRequires(
|
self.dc = sunbeam_dc_svc.DomainConfigRequires(
|
||||||
|
@ -34,7 +34,7 @@ an observer for relation changed events.
|
|||||||
|
|
||||||
.. code:: python
|
.. 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."""
|
"""Configure event handlers for a MySQL relation."""
|
||||||
logger.debug("Setting up DB event handler")
|
logger.debug("Setting up DB event handler")
|
||||||
# Lazy import to ensure this lib is only required if the charm
|
# Lazy import to ensure this lib is only required if the charm
|
||||||
|
@ -48,7 +48,7 @@ ContainerDir = collections.namedtuple(
|
|||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
class PebbleHandler(ops.charm.Object):
|
class PebbleHandler(ops.framework.Object):
|
||||||
"""Base handler for Pebble based containers."""
|
"""Base handler for Pebble based containers."""
|
||||||
|
|
||||||
def __init__(
|
def __init__(
|
||||||
|
@ -474,7 +474,7 @@ class OVSDBCMSProvidesHandler(
|
|||||||
super().__init__(charm, relation_name, callback_f, mandatory)
|
super().__init__(charm, relation_name, callback_f, mandatory)
|
||||||
self._update_address_data()
|
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."""
|
"""Configure event handlers for an Identity service relation."""
|
||||||
# Lazy import to ensure this lib is only required if the charm
|
# Lazy import to ensure this lib is only required if the charm
|
||||||
# has this relation.
|
# has this relation.
|
||||||
@ -525,7 +525,7 @@ class OVSDBCMSRequiresHandler(
|
|||||||
"""Run constructor."""
|
"""Run constructor."""
|
||||||
super().__init__(charm, relation_name, callback_f, mandatory)
|
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."""
|
"""Configure event handlers for an Identity service relation."""
|
||||||
# Lazy import to ensure this lib is only required if the charm
|
# Lazy import to ensure this lib is only required if the charm
|
||||||
# has this relation.
|
# has this relation.
|
||||||
|
@ -51,7 +51,7 @@ ERASURE_CODED = "erasure-coded"
|
|||||||
REPLICATED = "replicated"
|
REPLICATED = "replicated"
|
||||||
|
|
||||||
|
|
||||||
class RelationHandler(ops.charm.Object):
|
class RelationHandler(ops.framework.Object):
|
||||||
"""Base handler class for relations.
|
"""Base handler class for relations.
|
||||||
|
|
||||||
A relation handler is used to manage a charms interaction with a relation
|
A relation handler is used to manage a charms interaction with a relation
|
||||||
@ -105,7 +105,7 @@ class RelationHandler(ops.charm.Object):
|
|||||||
else:
|
else:
|
||||||
status.set(WaitingStatus("integration incomplete"))
|
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.
|
"""Configure event handlers for the relation.
|
||||||
|
|
||||||
This method must be overridden in concrete class
|
This method must be overridden in concrete class
|
||||||
@ -113,7 +113,7 @@ class RelationHandler(ops.charm.Object):
|
|||||||
"""
|
"""
|
||||||
raise NotImplementedError
|
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.
|
"""Return the interface that this handler encapsulates.
|
||||||
|
|
||||||
This is a combination of the interface object and the
|
This is a combination of the interface object and the
|
||||||
@ -166,7 +166,7 @@ class IngressHandler(RelationHandler):
|
|||||||
self.service_name = service_name
|
self.service_name = service_name
|
||||||
super().__init__(charm, relation_name, callback_f, mandatory)
|
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."""
|
"""Configure event handlers for an Ingress relation."""
|
||||||
logger.debug("Setting up ingress event handler")
|
logger.debug("Setting up ingress event handler")
|
||||||
from charms.traefik_k8s.v2.ingress import (
|
from charms.traefik_k8s.v2.ingress import (
|
||||||
@ -269,7 +269,7 @@ class DBHandler(RelationHandler):
|
|||||||
self.database_name = database
|
self.database_name = database
|
||||||
super().__init__(charm, relation_name, callback_f, mandatory)
|
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."""
|
"""Configure event handlers for a MySQL relation."""
|
||||||
logger.debug("Setting up DB event handler")
|
logger.debug("Setting up DB event handler")
|
||||||
# Import here to avoid import errors if ops_sunbeam is being used
|
# Import here to avoid import errors if ops_sunbeam is being used
|
||||||
@ -404,7 +404,7 @@ class RabbitMQHandler(RelationHandler):
|
|||||||
self.vhost = vhost
|
self.vhost = vhost
|
||||||
super().__init__(charm, relation_name, callback_f, mandatory)
|
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."""
|
"""Configure event handlers for an AMQP relation."""
|
||||||
logger.debug("Setting up AMQP event handler")
|
logger.debug("Setting up AMQP event handler")
|
||||||
# Lazy import to ensure this lib is only required if the charm
|
# Lazy import to ensure this lib is only required if the charm
|
||||||
@ -495,7 +495,7 @@ class IdentityServiceRequiresHandler(RelationHandler):
|
|||||||
self.region = region
|
self.region = region
|
||||||
super().__init__(charm, relation_name, callback_f, mandatory)
|
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."""
|
"""Configure event handlers for an Identity service relation."""
|
||||||
logger.debug("Setting up Identity Service event handler")
|
logger.debug("Setting up Identity Service event handler")
|
||||||
import charms.keystone_k8s.v1.identity_service as sun_id
|
import charms.keystone_k8s.v1.identity_service as sun_id
|
||||||
@ -654,7 +654,7 @@ class CephClientHandler(RelationHandler):
|
|||||||
self.app_name = app_name
|
self.app_name = app_name
|
||||||
super().__init__(charm, relation_name, callback_f, mandatory)
|
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."""
|
"""Configure event handlers for an ceph-client interface."""
|
||||||
logger.debug("Setting up ceph-client event handler")
|
logger.debug("Setting up ceph-client event handler")
|
||||||
# Lazy import to ensure this lib is only required if the charm
|
# 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)
|
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."""
|
"""Configure event handlers for identity-credentials relation."""
|
||||||
import charms.keystone_k8s.v0.identity_credentials as identity_credentials
|
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)
|
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."""
|
"""Configure event handlers for ceph-access relation."""
|
||||||
import charms.cinder_ceph_k8s.v0.ceph_access as ceph_access
|
import charms.cinder_ceph_k8s.v0.ceph_access as ceph_access
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user