mirror of
https://github.com/freedombox/FreedomBox.git
synced 2026-04-22 10:01:45 +00:00
backups: Allow storing root repository details
- This allows schedule to be stored along with the repository information. Tests performed: - Storing/retrieving a schedule along with root repository works. Signed-off-by: Sunil Mohan Adapa <sunil@medhas.org> Reviewed-by: James Valleroy <jvalleroy@mailbox.org>
This commit is contained in:
parent
01e00cdde4
commit
3789048854
@ -484,17 +484,24 @@ def _ssh_connection(hostname, username, password):
|
||||
|
||||
def get_repositories():
|
||||
"""Get all repositories of a given storage type."""
|
||||
repositories = [get_instance(RootBorgRepository.UUID)]
|
||||
for uuid in store.get_storages():
|
||||
repositories = []
|
||||
storages = store.get_storages()
|
||||
for uuid in storages:
|
||||
repositories.append(get_instance(uuid))
|
||||
|
||||
if RootBorgRepository.UUID not in storages:
|
||||
repositories.append(get_instance(RootBorgRepository.UUID))
|
||||
|
||||
return sorted(repositories, key=lambda x: x.sort_order)
|
||||
|
||||
|
||||
def get_instance(uuid):
|
||||
"""Create a local or SSH repository object instance."""
|
||||
if uuid == RootBorgRepository.UUID:
|
||||
return RootBorgRepository()
|
||||
try:
|
||||
return RootBorgRepository.load(uuid)
|
||||
except KeyError:
|
||||
return RootBorgRepository()
|
||||
|
||||
storage = store.get(uuid)
|
||||
if storage['storage_type'] == 'ssh':
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user