From 58852f68aa79b56da815b46864d7da2343feebba Mon Sep 17 00:00:00 2001 From: Javier Hernandez Date: Mon, 8 Jan 2024 09:51:11 +0100 Subject: 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 --- ogcp/views.py | 4 ++++ 1 file changed, 4 insertions(+) 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') } -- cgit v1.2.3-18-g5258