summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJavier Hernandez <jhernandez@soleta.eu>2024-01-08 09:51:11 +0100
committerOpenGnSys Support Team <soporte-og@soleta.eu>2024-01-08 10:28:11 +0100
commit58852f68aa79b56da815b46864d7da2343feebba (patch)
tree19f1590bf1ec29b21239e601cb80b00469fc7a28
parentf538364d941f38ad22ca514f726e6d02bf2b0a8e (diff)
views: Check for empty list of boot modes
In set boot mode, show an error if server replies with an empty list of boot modes
-rw-r--r--ogcp/views.py4
1 files changed, 4 insertions, 0 deletions
diff --git a/ogcp/views.py b/ogcp/views.py
index 32aa244..b83abb4 100644
--- a/ogcp/views.py
+++ b/ogcp/views.py
@@ -1216,6 +1216,10 @@ def action_mode():
category='error')
return redirect(url_for('commands'))
available_modes = [(mode, mode) for mode in r.json()['modes']]
+ if not available_modes:
+ flash(_('no boot templates are available in the server'),
+ category='error')
+ return redirect(url_for('commands'))
form.boot.choices = list(available_modes)
form.ok.render_kw = { 'formaction': url_for('action_mode') }