diff options
author | Javier Sánchez Parra <jsanchez@soleta.eu> | 2022-09-22 14:01:17 +0200 |
---|---|---|
committer | Javier Sánchez Parra <jsanchez@soleta.eu> | 2022-09-29 13:01:28 +0200 |
commit | 30d27c89511562fa639b566ad3b186be7b074345 (patch) | |
tree | df4cc92d993f0bde1759e1154eaea0ec73cb4173 /ogcp/views.py | |
parent | 6142a171fd7c5295eca73d820b368401b9d519b2 (diff) |
Adapt aux function to work with several ogServers
Otherwise, get_repositories() and get_repository() functions only get
the repositories of the first ogServer of the list.
Diffstat (limited to 'ogcp/views.py')
-rw-r--r-- | ogcp/views.py | 14 |
1 files changed, 7 insertions, 7 deletions
diff --git a/ogcp/views.py b/ogcp/views.py index 1be52a0..cc6c2a3 100644 --- a/ogcp/views.py +++ b/ogcp/views.py @@ -135,15 +135,15 @@ def get_clients(state_filter=None): return clients -def get_repository(repository_id): - repositories = get_repositories() +def get_repository(repository_id, server): + repositories = get_repositories(server) [repository] = [repository for repository in repositories if repository['id'] == repository_id] return repository -def get_repositories(): - r = g.server.get('/repositories') +def get_repositories(server): + r = server.get('/repositories') repositories = r.json()['repositories'] return repositories @@ -620,7 +620,7 @@ def action_image_restore(): if not image: flash(_(f'Image to restore was not found'), category='error') return redirect(url_for('commands')) - repository = get_repository(image['repo_id']) + repository = get_repository(image['repo_id'], server) payload = {'disk': disk, 'partition': partition, @@ -1145,7 +1145,7 @@ def action_image_create(): f"{_('FS')} {FS_CODES[fs_id]}") form.os.choices.append((choice_value, choice_name)) - repositories = get_repositories() + repositories = get_repositories(server) for repo in repositories: form.repository.choices.append((repo['id'], repo['name'])) @@ -1169,7 +1169,7 @@ def action_image_update(): if not image: flash(_('Image to restore was not found'), category='error') return redirect(url_for('commands')) - repository = get_repository(image['repo_id']) + repository = get_repository(image['repo_id'], server) payload = {'clients': [ip], 'disk': disk, 'partition': partition, |