mirror of
https://github.com/freedombox/FreedomBox.git
synced 2026-05-27 10:44:33 +00:00
backups: Avoid creating duplicate SSH remotes
Signed-off-by: Joseph Nuthalapati <njoseph@thoughtworks.com>
This commit is contained in:
parent
e618e08fe7
commit
fb67c60a84
@ -154,7 +154,12 @@ class AddRepositoryForm(forms.Form):
|
||||
path = cleaned_data.get("repository")
|
||||
credentials = self.get_credentials()
|
||||
|
||||
# Validate remote
|
||||
# Avoid creation of duplicate ssh remotes
|
||||
for storage in network_storage.get_storages().values():
|
||||
if storage['path'] == path:
|
||||
raise forms.ValidationError(
|
||||
_('Remote backup repository already exists.'))
|
||||
|
||||
user_at_host, dir_path = path.split(':')
|
||||
username, hostname = user_at_host.split('@')
|
||||
dir_path = dir_path.replace('~', f'/home/{username}')
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user