mirror of
https://github.com/freedombox/FreedomBox.git
synced 2026-05-13 10:30:16 +00:00
backups: Minor simplification when adding remote repository
Signed-off-by: Sunil Mohan Adapa <sunil@medhas.org> Reviewed-by: James Valleroy <jvalleroy@mailbox.org>
This commit is contained in:
parent
c159c484ec
commit
063587f7ac
@ -269,6 +269,7 @@ class AddRepositoryView(SuccessMessageMixin, FormView):
|
|||||||
repository.get_info()
|
repository.get_info()
|
||||||
except BorgRepositoryDoesNotExistError:
|
except BorgRepositoryDoesNotExistError:
|
||||||
repository.initialize(encryption)
|
repository.initialize(encryption)
|
||||||
|
|
||||||
repository.save(store_credentials=True, verified=True)
|
repository.save(store_credentials=True, verified=True)
|
||||||
return super().form_valid(form)
|
return super().form_valid(form)
|
||||||
|
|
||||||
@ -361,7 +362,6 @@ class VerifySshHostkeyView(SuccessMessageMixin, FormView):
|
|||||||
def _add_remote_repository(self):
|
def _add_remote_repository(self):
|
||||||
"""On successful verification of host, add repository."""
|
"""On successful verification of host, add repository."""
|
||||||
repository = self._get_repository()
|
repository = self._get_repository()
|
||||||
uuid = self.kwargs['uuid']
|
|
||||||
encryption = 'none'
|
encryption = 'none'
|
||||||
if 'encryption_passphrase' in repository.credentials and \
|
if 'encryption_passphrase' in repository.credentials and \
|
||||||
repository.credentials['encryption_passphrase']:
|
repository.credentials['encryption_passphrase']:
|
||||||
@ -393,7 +393,7 @@ class VerifySshHostkeyView(SuccessMessageMixin, FormView):
|
|||||||
messages.error(self.request, _('Repository removed.'))
|
messages.error(self.request, _('Repository removed.'))
|
||||||
# Remove the repository so that the user can have another go at
|
# Remove the repository so that the user can have another go at
|
||||||
# creating it.
|
# creating it.
|
||||||
get_instance(uuid).remove()
|
repository.remove()
|
||||||
return redirect(reverse_lazy('backups:add-remote-repository'))
|
return redirect(reverse_lazy('backups:add-remote-repository'))
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user