From 063587f7acb3bab1f7475d87eee793dc288ab59b Mon Sep 17 00:00:00 2001 From: Sunil Mohan Adapa Date: Wed, 28 Aug 2019 22:14:21 -0700 Subject: [PATCH] backups: Minor simplification when adding remote repository Signed-off-by: Sunil Mohan Adapa Reviewed-by: James Valleroy --- plinth/modules/backups/views.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/plinth/modules/backups/views.py b/plinth/modules/backups/views.py index 1b5fc39e8..c0bb1f363 100644 --- a/plinth/modules/backups/views.py +++ b/plinth/modules/backups/views.py @@ -269,6 +269,7 @@ class AddRepositoryView(SuccessMessageMixin, FormView): repository.get_info() except BorgRepositoryDoesNotExistError: repository.initialize(encryption) + repository.save(store_credentials=True, verified=True) return super().form_valid(form) @@ -361,7 +362,6 @@ class VerifySshHostkeyView(SuccessMessageMixin, FormView): def _add_remote_repository(self): """On successful verification of host, add repository.""" repository = self._get_repository() - uuid = self.kwargs['uuid'] encryption = 'none' if 'encryption_passphrase' in repository.credentials and \ repository.credentials['encryption_passphrase']: @@ -393,7 +393,7 @@ class VerifySshHostkeyView(SuccessMessageMixin, FormView): messages.error(self.request, _('Repository removed.')) # Remove the repository so that the user can have another go at # creating it. - get_instance(uuid).remove() + repository.remove() return redirect(reverse_lazy('backups:add-remote-repository'))