diff --git a/medusa/backup_manager.py b/medusa/backup_manager.py index bc8d7d43..7abdcca4 100644 --- a/medusa/backup_manager.py +++ b/medusa/backup_manager.py @@ -99,7 +99,7 @@ def set_backup_future(backup_name, future): # Sets the future for a backup; unknown on overall status at this point unless already existing @staticmethod - def register_backup(backup_name, is_async): + def register_backup(backup_name, is_async, overwrite_existing=True): if not backup_name: raise RuntimeError(BackupMan.NO_BACKUP_NAME_ERR_MSG) @@ -109,9 +109,9 @@ def register_backup(backup_name, is_async): BackupMan() if backup_name in BackupMan.__instance.__backups: - logging.debug("Registered backup name {} found existing, replacing with new".format(backup_name)) - if not BackupMan.__clean(backup_name): - logging.error("Registered backup name {} cleanup failed prior to re-register.".format(backup_name)) + if overwrite_existing: + if not BackupMan.__clean(backup_name): + logging.error(f"Registered backup name {backup_name} cleanup failed prior to re-register.") BackupMan.__instance.__backups[backup_name] = [None, BackupMan.STATUS_UNKNOWN, is_async] logging.info("Registered backup id {}".format(backup_name)) diff --git a/medusa/service/grpc/server.py b/medusa/service/grpc/server.py index b40e5bb5..c47d47e9 100644 --- a/medusa/service/grpc/server.py +++ b/medusa/service/grpc/server.py @@ -189,7 +189,7 @@ def BackupStatus(self, request, context): response.finishTime = datetime.fromtimestamp(backup.finished).strftime(TIMESTAMP_FORMAT) else: response.finishTime = "" - BackupMan.register_backup(request.backupName, is_async=False) + BackupMan.register_backup(request.backupName, is_async=False, overwrite_existing=False) status = BackupMan.STATUS_UNKNOWN if backup.started: status = BackupMan.STATUS_IN_PROGRESS diff --git a/tests/integration/features/steps/integration_steps.py b/tests/integration/features/steps/integration_steps.py index f7f45ff9..0c297660 100644 --- a/tests/integration/features/steps/integration_steps.py +++ b/tests/integration/features/steps/integration_steps.py @@ -729,7 +729,7 @@ def _i_wait_for_async_backup_to_finish(context, backup_name): if status == medusa_pb2.StatusType.SUCCESS: break logging.debug(f'Backup {backup_name} is not yet finished, waiting...') - time.sleep(2) + time.sleep(1) @when(r'I perform a backup over gRPC in "{backup_mode}" mode of the node named "{backup_name}" and it fails')