mirror of
https://git.selfprivacy.org/SelfPrivacy/selfprivacy-rest-api.git
synced 2025-01-23 09:16:51 +00:00
feature(backups): temporarily revert restore job status to created for inplace restore to run backup
This commit is contained in:
parent
c68239044f
commit
1333aad57d
|
@ -306,6 +306,9 @@ class Backups:
|
||||||
snapshot: Snapshot,
|
snapshot: Snapshot,
|
||||||
job: Job,
|
job: Job,
|
||||||
) -> None:
|
) -> None:
|
||||||
|
Jobs.update(
|
||||||
|
job, status=JobStatus.CREATED, status_text=f"Waiting for pre-restore backup"
|
||||||
|
)
|
||||||
failsafe_snapshot = Backups.back_up(service)
|
failsafe_snapshot = Backups.back_up(service)
|
||||||
|
|
||||||
Jobs.update(
|
Jobs.update(
|
||||||
|
@ -321,7 +324,7 @@ class Backups:
|
||||||
Jobs.update(
|
Jobs.update(
|
||||||
job,
|
job,
|
||||||
status=JobStatus.ERROR,
|
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(
|
Backups._restore_service_from_snapshot(
|
||||||
service, failsafe_snapshot.id, verify=False
|
service, failsafe_snapshot.id, verify=False
|
||||||
|
@ -329,7 +332,7 @@ class Backups:
|
||||||
Jobs.update(
|
Jobs.update(
|
||||||
job,
|
job,
|
||||||
status=JobStatus.ERROR,
|
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
|
raise error
|
||||||
|
|
||||||
|
@ -348,7 +351,7 @@ class Backups:
|
||||||
try:
|
try:
|
||||||
Backups._assert_restorable(snapshot)
|
Backups._assert_restorable(snapshot)
|
||||||
Jobs.update(
|
Jobs.update(
|
||||||
job, status=JobStatus.CREATED, status_text="stopping the service"
|
job, status=JobStatus.RUNNING, status_text="Stopping the service"
|
||||||
)
|
)
|
||||||
with StoppedService(service):
|
with StoppedService(service):
|
||||||
Backups.assert_dead(service)
|
Backups.assert_dead(service)
|
||||||
|
@ -369,7 +372,7 @@ class Backups:
|
||||||
job,
|
job,
|
||||||
status=JobStatus.RUNNING,
|
status=JobStatus.RUNNING,
|
||||||
progress=90,
|
progress=90,
|
||||||
status_text="restarting the service",
|
status_text="Restarting the service",
|
||||||
)
|
)
|
||||||
|
|
||||||
except Exception as error:
|
except Exception as error:
|
||||||
|
|
Loading…
Reference in a new issue