diff --git a/plinth/modules/backups/repository.py b/plinth/modules/backups/repository.py index 2f974aa68..3f15fb8a4 100644 --- a/plinth/modules/backups/repository.py +++ b/plinth/modules/backups/repository.py @@ -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) diff --git a/plinth/modules/backups/views.py b/plinth/modules/backups/views.py index 9b567666c..6e3fa31fd 100644 --- a/plinth/modules/backups/views.py +++ b/plinth/modules/backups/views.py @@ -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)