mirror of https://git.48k.eu/ogcp
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' selectormaster
parent
906c3070ed
commit
a5a5ef362b
|
@ -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)})
|
||||
|
|
Loading…
Reference in New Issue