mirror of
https://github.com/freedombox/FreedomBox.git
synced 2026-01-21 07:55:00 +00:00
Backups: allow creating archive in unmounted repository
- mount repository if necessary before creating an archive Reviewed-by: James Valleroy <jvalleroy@mailbox.org>
This commit is contained in:
parent
067fea7d17
commit
b2f5d68ca6
@ -359,9 +359,9 @@ def get_ssh_repositories():
|
||||
return repositories
|
||||
|
||||
|
||||
def get_repository(uuid):
|
||||
def get_repository(uuid, automount=False):
|
||||
"""Get a repository (BorgRepository or SshBorgRepository)"""
|
||||
if uuid == ROOT_REPOSITORY_UUID:
|
||||
return BorgRepository(path=ROOT_REPOSITORY)
|
||||
else:
|
||||
return SshBorgRepository(uuid=uuid, automount=False)
|
||||
return SshBorgRepository(uuid=uuid, automount=automount)
|
||||
|
||||
@ -92,7 +92,8 @@ class CreateArchiveView(SuccessMessageMixin, FormView):
|
||||
|
||||
def form_valid(self, form):
|
||||
"""Create the archive on valid form submission."""
|
||||
repository = get_repository(form.cleaned_data['repository'])
|
||||
repository = get_repository(form.cleaned_data['repository'],
|
||||
automount=True)
|
||||
name = datetime.now().strftime('%Y-%m-%d:%H:%M')
|
||||
repository.create_archive(name, form.cleaned_data['selected_apps'])
|
||||
return super().form_valid(form)
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user