mirror of
https://github.com/freedombox/FreedomBox.git
synced 2026-05-13 10:30:16 +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
|
return repositories
|
||||||
|
|
||||||
|
|
||||||
def get_repository(uuid):
|
def get_repository(uuid, automount=False):
|
||||||
"""Get a repository (BorgRepository or SshBorgRepository)"""
|
"""Get a repository (BorgRepository or SshBorgRepository)"""
|
||||||
if uuid == ROOT_REPOSITORY_UUID:
|
if uuid == ROOT_REPOSITORY_UUID:
|
||||||
return BorgRepository(path=ROOT_REPOSITORY)
|
return BorgRepository(path=ROOT_REPOSITORY)
|
||||||
else:
|
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):
|
def form_valid(self, form):
|
||||||
"""Create the archive on valid form submission."""
|
"""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')
|
name = datetime.now().strftime('%Y-%m-%d:%H:%M')
|
||||||
repository.create_archive(name, form.cleaned_data['selected_apps'])
|
repository.create_archive(name, form.cleaned_data['selected_apps'])
|
||||||
return super().form_valid(form)
|
return super().form_valid(form)
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user