@@ -50,7 +50,6 @@ def is_unit_blocked(self) -> bool:
50
50
import pathlib
51
51
import re
52
52
import typing
53
- from typing import Dict , List , Optional , Tuple
54
53
55
54
from charms .data_platform_libs .v0 .s3 import (
56
55
CredentialsChangedEvent ,
@@ -113,7 +112,7 @@ def is_unit_blocked(self) -> bool:
113
112
114
113
# Increment this PATCH version before using `charmcraft publish-lib` or reset
115
114
# to 0 if you are raising the major API version
116
- LIBPATCH = 14
115
+ LIBPATCH = 15
117
116
118
117
ANOTHER_S3_CLUSTER_REPOSITORY_ERROR_MESSAGE = "S3 repository claimed by another cluster"
119
118
MOVE_RESTORED_CLUSTER_TO_ANOTHER_S3_REPOSITORY_ERROR = (
@@ -150,7 +149,7 @@ def _s3_integrator_relation_exists(self) -> bool:
150
149
"""Returns whether a relation with the s3-integrator exists."""
151
150
return bool (self .model .get_relation (S3_INTEGRATOR_RELATION_NAME ))
152
151
153
- def _retrieve_s3_parameters (self ) -> Tuple [ Dict [str , str ], List [str ]]:
152
+ def _retrieve_s3_parameters (self ) -> tuple [ dict [str , str ], list [str ]]:
154
153
"""Retrieve S3 parameters from the S3 integrator relation.
155
154
156
155
Returns: tuple of (s3_parameters, missing_required_parameters)
@@ -196,7 +195,7 @@ def _upload_logs_to_s3(
196
195
stdout : str ,
197
196
stderr : str ,
198
197
log_filename : str ,
199
- s3_parameters : Dict [str , str ],
198
+ s3_parameters : dict [str , str ],
200
199
) -> bool :
201
200
"""Upload logs to S3 at the specified location.
202
201
@@ -219,7 +218,7 @@ def _upload_logs_to_s3(
219
218
# ------------------ List Backups ------------------
220
219
221
220
@staticmethod
222
- def _format_backups_list (backup_list : List [ Tuple [str , str ]]) -> str :
221
+ def _format_backups_list (backup_list : list [ tuple [str , str ]]) -> str :
223
222
"""Formats the provided list of backups as a table."""
224
223
backups = [f"{ 'backup-id' :<21} | { 'backup-type' :<12} | backup-status" ]
225
224
@@ -359,7 +358,7 @@ def _on_create_backup(self, event: ActionEvent) -> None:
359
358
})
360
359
self .charm ._on_update_status (None )
361
360
362
- def _can_unit_perform_backup (self ) -> Tuple [bool , Optional [ str ] ]:
361
+ def _can_unit_perform_backup (self ) -> tuple [bool , str | None ]:
363
362
"""Validates whether this unit can perform a backup.
364
363
365
364
Returns: tuple of (success, error_message)
@@ -390,7 +389,7 @@ def _can_unit_perform_backup(self) -> Tuple[bool, Optional[str]]:
390
389
391
390
return True , None
392
391
393
- def _pre_backup (self ) -> Tuple [bool , Optional [ str ] ]:
392
+ def _pre_backup (self ) -> tuple [bool , str | None ]:
394
393
"""Runs operations required before performing a backup.
395
394
396
395
Returns: tuple of (success, error_message)
@@ -415,7 +414,7 @@ def _pre_backup(self) -> Tuple[bool, Optional[str]]:
415
414
416
415
return True , None
417
416
418
- def _backup (self , backup_path : str , s3_parameters : Dict ) -> Tuple [bool , Optional [ str ] ]:
417
+ def _backup (self , backup_path : str , s3_parameters : dict ) -> tuple [bool , str | None ]:
419
418
"""Runs the backup operations.
420
419
421
420
Args:
@@ -450,7 +449,7 @@ def _backup(self, backup_path: str, s3_parameters: Dict) -> Tuple[bool, Optional
450
449
451
450
return True , None
452
451
453
- def _post_backup (self ) -> Tuple [bool , Optional [ str ] ]:
452
+ def _post_backup (self ) -> tuple [bool , str | None ]:
454
453
"""Runs operations required after performing a backup.
455
454
456
455
Returns: tuple of (success, error_message)
@@ -613,7 +612,7 @@ def _on_restore(self, event: ActionEvent) -> None: # noqa: C901
613
612
# update status as soon as possible
614
613
self .charm ._on_update_status (None )
615
614
616
- def _pre_restore (self ) -> Tuple [bool , str ]:
615
+ def _pre_restore (self ) -> tuple [bool , str ]:
617
616
"""Perform operations that need to be done before performing a restore.
618
617
619
618
Returns: tuple of (success, error_message)
@@ -635,7 +634,7 @@ def _pre_restore(self) -> Tuple[bool, str]:
635
634
636
635
return True , ""
637
636
638
- def _restore (self , backup_id : str , s3_parameters : Dict [str , str ]) -> Tuple [bool , bool , str ]:
637
+ def _restore (self , backup_id : str , s3_parameters : dict [str , str ]) -> tuple [bool , bool , str ]:
639
638
"""Run the restore operations.
640
639
641
640
Args:
@@ -687,7 +686,7 @@ def _restore(self, backup_id: str, s3_parameters: Dict[str, str]) -> Tuple[bool,
687
686
688
687
return True , True , ""
689
688
690
- def _clean_data_dir_and_start_mysqld (self ) -> Tuple [bool , str ]:
689
+ def _clean_data_dir_and_start_mysqld (self ) -> tuple [bool , str ]:
691
690
"""Run idempotent operations run after restoring a backup.
692
691
693
692
Returns tuple of (success, error_message)
@@ -711,8 +710,8 @@ def _clean_data_dir_and_start_mysqld(self) -> Tuple[bool, str]:
711
710
return True , ""
712
711
713
712
def _pitr_restore (
714
- self , restore_to_time : str , s3_parameters : Dict [str , str ]
715
- ) -> Tuple [bool , str ]:
713
+ self , restore_to_time : str , s3_parameters : dict [str , str ]
714
+ ) -> tuple [bool , str ]:
716
715
try :
717
716
logger .info ("Restoring point-in-time-recovery" )
718
717
stdout , stderr = self .charm ._mysql .restore_pitr (
@@ -728,7 +727,7 @@ def _pitr_restore(
728
727
return False , f"Failed to restore point-in-time-recovery to the { restore_to_time } "
729
728
return True , ""
730
729
731
- def _post_restore (self ) -> Tuple [bool , str ]:
730
+ def _post_restore (self ) -> tuple [bool , str ]:
732
731
"""Run operations required after restoring a backup.
733
732
734
733
Returns: tuple of (success, error_message)
@@ -836,7 +835,7 @@ def _on_s3_credentials_gone(self, event: CredentialsGoneEvent) -> None:
836
835
"Exception is occurred when trying to stop binlogs collecting after S3 relation depart. It may be a leader departure"
837
836
)
838
837
839
- def get_binlogs_collector_config (self ) -> Dict [str , str ]:
838
+ def get_binlogs_collector_config (self ) -> dict [str , str ]:
840
839
"""Return binlogs collector service config file.
841
840
842
841
Returns: dict of binlogs collector service config
0 commit comments