From f538364d941f38ad22ca514f726e6d02bf2b0a8e Mon Sep 17 00:00:00 2001 From: Javier Hernandez Date: Thu, 4 Jan 2024 10:01:02 +0100 Subject: views: Make set boot-mode more robust Check that server replies with error code and display an error if it does. --- ogcp/views.py | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'ogcp') 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) -- cgit v1.2.3-18-g5258