File tree Expand file tree Collapse file tree 1 file changed +13
-2
lines changed Expand file tree Collapse file tree 1 file changed +13
-2
lines changed Original file line number Diff line number Diff line change @@ -41,15 +41,26 @@ def is_compatible(
41
41
old_workload_version : str ,
42
42
new_workload_version : str ,
43
43
) -> bool :
44
+ # Check charm version compatibility
44
45
if not super ().is_compatible (
45
46
old_charm_version = old_charm_version ,
46
47
new_charm_version = new_charm_version ,
47
48
old_workload_version = old_workload_version ,
48
49
new_workload_version = new_workload_version ,
49
50
):
50
51
return False
51
- # TODO: check workload version—prevent downgrade?
52
- return True
52
+
53
+ # Check workload version compatibility
54
+ old_major , old_minor , old_patch = (int (component ) for component in old_workload_version .split ("." ))
55
+ new_major , new_minor , new_patch = (int (component ) for component in new_workload_version .split ("." ))
56
+ if old_major != new_major :
57
+ return False
58
+ if new_minor > old_minor :
59
+ return True
60
+ elif new_minor == old_minor :
61
+ return new_patch >= old_patch
62
+ else :
63
+ return False
53
64
54
65
55
66
class MySQLRouterCharm (ops .CharmBase , abc .ABC ):
You can’t perform that action at this time.
0 commit comments