summaryrefslogtreecommitdiffstats
path: root/ogcp
diff options
context:
space:
mode:
authorJavier Hernandez <jhernandez@soleta.eu>2024-01-04 10:01:02 +0100
committerOpenGnSys Support Team <soporte-og@soleta.eu>2024-01-04 13:13:51 +0100
commitf538364d941f38ad22ca514f726e6d02bf2b0a8e (patch)
treeb14a3500be2de627e10f7c47ec7e0da906219ee6 /ogcp
parentb4856c9b279d30f8d0101efd14aca157b1535bea (diff)
views: Make set boot-mode more robust
Check that server replies with error code and display an error if it does.
Diffstat (limited to 'ogcp')
-rw-r--r--ogcp/views.py4
1 files changed, 4 insertions, 0 deletions
diff --git a/ogcp/views.py b/ogcp/views.py
index db56169..32aa244 100644
--- a/ogcp/views.py
+++ b/ogcp/views.py
@@ -1211,6 +1211,10 @@ def action_mode():
server = get_server_from_clients(ips)
modes_set = get_clients_modes(ips, server)
r = server.get('/mode')
+ if r.status_code != requests.codes.ok:
+ flash(_('Ogserver replied with status code not ok'),
+ category='error')
+ return redirect(url_for('commands'))
available_modes = [(mode, mode) for mode in r.json()['modes']]
form.boot.choices = list(available_modes)