diff options
author | Javier Hernandez <jhernandez@soleta.eu> | 2023-12-20 11:07:53 +0100 |
---|---|---|
committer | OpenGnSys Support Team <soporte-og@soleta.eu> | 2023-12-20 11:10:07 +0100 |
commit | a5a5ef362b0e8bb79477070ea3598b90a89b977a (patch) | |
tree | 1f04bebf68da20f44d8b097f95a03169cdbf685b /ogcp | |
parent | 906c3070edd8973df823f60ea935f1985625c8d6 (diff) |
views: Limit update image to images available in assigned repository
Allow to update only images that are in the repo the client is assigned
to; if an image is inside a different repo, it will not appear in the
'Image' selector
Diffstat (limited to 'ogcp')
-rw-r--r-- | ogcp/views.py | 10 |
1 files changed, 8 insertions, 2 deletions
diff --git a/ogcp/views.py b/ogcp/views.py index 766db70..b59f0f0 100644 --- a/ogcp/views.py +++ b/ogcp/views.py @@ -1320,8 +1320,14 @@ def action_image_update(): form.ip.data = ' '.join(ips) server = get_server_from_clients(ips) - r = server.get('/images') - for image in r.json()['images']: + r = server.get('/client/info', payload={'client': list(ips)}) + repo_id = r.json()['repo_id'] + images = get_images_grouped_by_repos_from_server(server) + if repo_id not in images: + flash(_('Computer is assigned to a repo with no images'), + category='error') + return redirect(url_for('commands')) + for image in images[repo_id]: form.image.choices.append((image['id'], image['name'])) r = server.get('/client/setup', payload={'client': list(ips)}) |