File tree Expand file tree Collapse file tree 2 files changed +12
-5
lines changed Expand file tree Collapse file tree 2 files changed +12
-5
lines changed Original file line number Diff line number Diff line change 4
4
"""MySQL Router charm"""
5
5
6
6
import abc
7
+ import dataclasses
7
8
import logging
8
9
import typing
9
10
23
24
logger = logging .getLogger (__name__ )
24
25
25
26
26
- class RouterRefresh (charm_refresh .CharmSpecific ):
27
+ @dataclasses .dataclass (eq = False )
28
+ class RouterRefresh (charm_refresh .CharmSpecificCommon , abc .ABC ):
27
29
"""MySQL Router refresh callbacks & configuration"""
28
30
29
31
@staticmethod
@@ -58,7 +60,7 @@ class MySQLRouterCharm(ops.CharmBase, abc.ABC):
58
60
_READ_WRITE_X_PORT = 6448
59
61
_READ_ONLY_X_PORT = 6449
60
62
61
- refresh : charm_refresh .Refresh
63
+ refresh : charm_refresh .Common
62
64
63
65
def __init__ (self , * args ) -> None :
64
66
super ().__init__ (* args )
Original file line number Diff line number Diff line change 13
13
if is_wrong_architecture () and __name__ == "__main__" :
14
14
ops .main .main (WrongArchitectureWarningCharm )
15
15
16
+ import dataclasses
16
17
import enum
17
18
import functools
18
19
import json
@@ -52,6 +53,11 @@ class _ServiceType(enum.Enum):
52
53
LOAD_BALANCER = "LoadBalancer"
53
54
54
55
56
+ @dataclasses .dataclass (eq = False )
57
+ class KubernetesRouterRefresh (abstract_charm .RouterRefresh , charm_refresh .CharmSpecificKubernetes ):
58
+ """MySQL Router Kubernetes refresh callbacks & configuration"""
59
+
60
+
55
61
@trace_charm (
56
62
tracing_endpoint = "tracing_endpoint" ,
57
63
extra_types = (
@@ -88,9 +94,8 @@ def __init__(self, *args) -> None:
88
94
self .on [rock .CONTAINER_NAME ].pebble_ready , self ._on_workload_container_pebble_ready
89
95
)
90
96
try :
91
- self .refresh = charm_refresh .Refresh (
92
- abstract_charm .RouterRefresh (
93
- cloud = charm_refresh .Cloud .KUBERNETES ,
97
+ self .refresh = charm_refresh .Kubernetes (
98
+ KubernetesRouterRefresh (
94
99
workload_name = "Router" ,
95
100
refresh_user_docs_url = "https://charmhub.io/mysql-router-k8s/docs/h-upgrade" ,
96
101
oci_resource_name = "mysql-router-image" ,
You can’t perform that action at this time.
0 commit comments