summaryrefslogtreecommitdiffstats
path: root/ogcp/views.py
diff options
context:
space:
mode:
authorJavier Hernandez <jhernandez@soleta.eu>2024-01-18 10:18:40 +0100
committerOpenGnSys Support Team <soporte-og@soleta.eu>2024-01-18 10:26:28 +0100
commit4acb37d8c573f19f25fdaa1c0ecd0125ba45e79b (patch)
tree47a39522b2bd89a044400f6d1613455813bc8bfa /ogcp/views.py
parent02b6059c70d5261a206c28b716512605e5dc4cdf (diff)
views: fix client update form crashing
Fix client update view crashing due to missing images variable. Check if GET /images fails.
Diffstat (limited to 'ogcp/views.py')
-rw-r--r--ogcp/views.py6
1 files changed, 6 insertions, 0 deletions
diff --git a/ogcp/views.py b/ogcp/views.py
index 9aaef17..c0b2c98 100644
--- a/ogcp/views.py
+++ b/ogcp/views.py
@@ -1009,6 +1009,12 @@ def action_client_update():
if setup and setup[0].get('code') == 'MSDOS':
setup[0]['code'] = 'MBR'
+ r = server.get('/images')
+ if r.status_code != requests.codes.ok:
+ flash(_('ogServer: error retrieving images list'),
+ category='error')
+ return redirect(url_for('scopes'))
+ images = r.json()['images']
for entry in setup:
if images and entry['image'] != 0:
image = next((img for img in images if img['id'] == entry['image']), None)