From 1333aad57dac56dea8f0d2b990bc0a66467c9a4b Mon Sep 17 00:00:00 2001 From: Houkime <> Date: Wed, 23 Aug 2023 14:35:03 +0000 Subject: [PATCH] feature(backups): temporarily revert restore job status to created for inplace restore to run backup --- selfprivacy_api/backup/__init__.py | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/selfprivacy_api/backup/__init__.py b/selfprivacy_api/backup/__init__.py index 0f445a8..7b013f4 100644 --- a/selfprivacy_api/backup/__init__.py +++ b/selfprivacy_api/backup/__init__.py @@ -306,6 +306,9 @@ class Backups: snapshot: Snapshot, job: Job, ) -> None: + Jobs.update( + job, status=JobStatus.CREATED, status_text=f"Waiting for pre-restore backup" + ) failsafe_snapshot = Backups.back_up(service) Jobs.update( @@ -321,7 +324,7 @@ class Backups: Jobs.update( job, status=JobStatus.ERROR, - status_text=f" restore failed with {str(error)}, reverting to {failsafe_snapshot.id}", + status_text=f"Restore failed with {str(error)}, reverting to {failsafe_snapshot.id}", ) Backups._restore_service_from_snapshot( service, failsafe_snapshot.id, verify=False @@ -329,7 +332,7 @@ class Backups: Jobs.update( job, status=JobStatus.ERROR, - status_text=f" restore failed with {str(error)}, reverted to {failsafe_snapshot.id}", + status_text=f"Restore failed with {str(error)}, reverted to {failsafe_snapshot.id}", ) raise error @@ -348,7 +351,7 @@ class Backups: try: Backups._assert_restorable(snapshot) Jobs.update( - job, status=JobStatus.CREATED, status_text="stopping the service" + job, status=JobStatus.RUNNING, status_text="Stopping the service" ) with StoppedService(service): Backups.assert_dead(service) @@ -369,7 +372,7 @@ class Backups: job, status=JobStatus.RUNNING, progress=90, - status_text="restarting the service", + status_text="Restarting the service", ) except Exception as error: