diff --git a/lib/charms/traefik_route_k8s/v0/traefik_route.py b/lib/charms/traefik_k8s/v0/traefik_route.py similarity index 96% rename from lib/charms/traefik_route_k8s/v0/traefik_route.py rename to lib/charms/traefik_k8s/v0/traefik_route.py index de2da555..17708603 100644 --- a/lib/charms/traefik_route_k8s/v0/traefik_route.py +++ b/lib/charms/traefik_k8s/v0/traefik_route.py @@ -15,7 +15,7 @@ ```shell cd some-charm -charmcraft fetch-lib charms.traefik_route_k8s.v0.traefik_route +charmcraft fetch-lib charms.traefik_k8s.v0.traefik_route ``` To use the library from the provider side (Traefik): @@ -28,7 +28,7 @@ ``` ```python -from charms.traefik_route_k8s.v0.traefik_route import TraefikRouteProvider +from charms.traefik_k8s.v0.traefik_route import TraefikRouteProvider class TraefikCharm(CharmBase): def __init__(self, *args): @@ -56,7 +56,7 @@ def _handle_traefik_route_ready(self, event): ```python # ... -from charms.traefik_route_k8s.v0.traefik_route import TraefikRouteRequirer +from charms.traefik_k8s.v0.traefik_route import TraefikRouteRequirer class TraefikRouteCharm(CharmBase): def __init__(self, *args): @@ -88,7 +88,7 @@ def __init__(self, *args): # Increment this PATCH version before using `charmcraft publish-lib` or reset # to 0 if you are raising the major API version -LIBPATCH = 10 +LIBPATCH = 1 log = logging.getLogger(__name__) @@ -254,8 +254,10 @@ def is_ready(self, relation: Relation) -> bool: def get_config(self, relation: Relation) -> Optional[str]: """Renamed to ``get_dynamic_config``.""" - log.warning("``TraefikRouteProvider.get_config`` is deprecated. " - "Use ``TraefikRouteProvider.get_dynamic_config`` instead") + log.warning( + "``TraefikRouteProvider.get_config`` is deprecated. " + "Use ``TraefikRouteProvider.get_dynamic_config`` instead" + ) return self.get_dynamic_config(relation) def get_dynamic_config(self, relation: Relation) -> Optional[str]: @@ -356,7 +358,7 @@ def is_ready(self) -> bool: """Is the TraefikRouteRequirer ready to submit data to Traefik?""" return self._relation is not None - def submit_to_traefik(self, config: dict, static: dict=None): + def submit_to_traefik(self, config: dict, static: Optional[dict] = None): """Relay an ingress configuration data structure to traefik. This will publish to the traefik-route relation databag diff --git a/src/charm.py b/src/charm.py index 59aa5cd0..4f97276b 100755 --- a/src/charm.py +++ b/src/charm.py @@ -37,16 +37,16 @@ from charms.prometheus_k8s.v0.prometheus_scrape import MetricsEndpointProvider from charms.tempo_k8s.v1.charm_tracing import trace_charm from charms.tempo_k8s.v2.tracing import TracingEndpointRequirer +from charms.traefik_k8s.v0.traefik_route import ( + TraefikRouteProvider, + TraefikRouteRequirerReadyEvent, +) from charms.traefik_k8s.v1.ingress import IngressPerAppProvider as IPAv1 from charms.traefik_k8s.v1.ingress_per_unit import ( DataValidationError, IngressPerUnitProvider, ) from charms.traefik_k8s.v2.ingress import IngressPerAppProvider as IPAv2 -from charms.traefik_route_k8s.v0.traefik_route import ( - TraefikRouteProvider, - TraefikRouteRequirerReadyEvent, -) from deepmerge import always_merger from lightkube.core.client import Client from lightkube.core.exceptions import ApiError diff --git a/tests/integration/conftest.py b/tests/integration/conftest.py index 6f20d3f4..13b0f467 100644 --- a/tests/integration/conftest.py +++ b/tests/integration/conftest.py @@ -72,7 +72,7 @@ def copy_traefik_library_into_tester_charms(ops_test): "traefik_k8s/v2/ingress.py", "traefik_k8s/v1/ingress_per_unit.py", "observability_libs/v1/kubernetes_service_patch.py", - "traefik_route_k8s/v0/traefik_route.py", + "traefik_k8s/v0/traefik_route.py", ] for tester in ["forward-auth", "ipa", "ipu", "tcp", "route"]: for lib in libraries: diff --git a/tests/integration/spellbook/build_all_caches.py b/tests/integration/spellbook/build_all_caches.py index ad617190..254cdb52 100644 --- a/tests/integration/spellbook/build_all_caches.py +++ b/tests/integration/spellbook/build_all_caches.py @@ -23,9 +23,7 @@ def main(): spellbook_fetch( charm_name="route-tester", charm_root=testers_root / "route", - pull_libs=[ - traefik_root / "lib" / "charms" / "traefik_route_k8s" / "v0" / "traefik_route.py" - ], + pull_libs=[traefik_root / "lib" / "charms" / "traefik_k8s" / "v0" / "traefik_route.py"], ) spellbook_fetch( charm_name="ipa-tester", diff --git a/tests/integration/testers/route/src/charm.py b/tests/integration/testers/route/src/charm.py index 9c059b23..cc4626bc 100755 --- a/tests/integration/testers/route/src/charm.py +++ b/tests/integration/testers/route/src/charm.py @@ -1,7 +1,7 @@ #!/usr/bin/env python3 # Copyright 2022 Canonical Ltd. # See LICENSE file for licensing details. -from charms.traefik_route_k8s.v0.traefik_route import TraefikRouteRequirer +from charms.traefik_k8s.v0.traefik_route import TraefikRouteRequirer from ops.charm import CharmBase from ops.model import ActiveStatus