mirror of
https://github.com/freedombox/FreedomBox.git
synced 2026-02-11 08:23:49 +00:00
backups: Cleanup auto-mounting SSH repositories
Remove auto-mounting of repositories during instantiation entirely. It is better to explicitly mount later. Signed-off-by: Sunil Mohan Adapa <sunil@medhas.org> Reviewed-by: Joseph Nuthalapati <njoseph@thoughtworks.com>
This commit is contained in:
parent
9c8674baa3
commit
984b7dca88
@ -237,8 +237,7 @@ class SshBorgRepository(BorgRepository):
|
||||
storage_type = 'ssh'
|
||||
uuid = None
|
||||
|
||||
def __init__(self, uuid=None, path=None, credentials=None, automount=False,
|
||||
**kwargs):
|
||||
def __init__(self, uuid=None, path=None, credentials=None, **kwargs):
|
||||
"""
|
||||
Instanciate a new repository.
|
||||
|
||||
@ -259,10 +258,6 @@ class SshBorgRepository(BorgRepository):
|
||||
else:
|
||||
self._load_from_kvstore()
|
||||
|
||||
if automount:
|
||||
if is_ssh_hostkey_verified(path):
|
||||
self.mount()
|
||||
|
||||
@property
|
||||
def repo_path(self):
|
||||
"""
|
||||
@ -391,9 +386,9 @@ def get_ssh_repositories():
|
||||
return repositories
|
||||
|
||||
|
||||
def get_repository(uuid, automount=False):
|
||||
def get_repository(uuid):
|
||||
"""Get a local or SSH repository object instance."""
|
||||
if uuid == ROOT_REPOSITORY_UUID:
|
||||
return BorgRepository(path=ROOT_REPOSITORY)
|
||||
|
||||
return SshBorgRepository(uuid=uuid, automount=automount)
|
||||
return SshBorgRepository(uuid=uuid)
|
||||
|
||||
@ -100,8 +100,10 @@ class CreateArchiveView(SuccessMessageMixin, FormView):
|
||||
|
||||
def form_valid(self, form):
|
||||
"""Create the archive on valid form submission."""
|
||||
repository = get_repository(form.cleaned_data['repository'],
|
||||
automount=True)
|
||||
repository = get_repository(form.cleaned_data['repository'])
|
||||
if hasattr(repository, 'mount'):
|
||||
repository.mount()
|
||||
|
||||
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