From c1548fd21993eb4cdfdbcabc13c5761db935e35f Mon Sep 17 00:00:00 2001 From: Javier Hernandez Date: Mon, 11 Dec 2023 13:26:34 +0100 Subject: views: Check form contain a cache partition Make the partition and format form fail if the user has not added a cache partition. A cache partition is required to make the restoration of images work --- ogcp/views.py | 8 ++++++++ 1 file changed, 8 insertions(+) (limited to 'ogcp') diff --git a/ogcp/views.py b/ogcp/views.py index 7c50ac9..6ad9918 100644 --- a/ogcp/views.py +++ b/ogcp/views.py @@ -557,6 +557,14 @@ def action_setup_show(): def action_setup_modify(): form = SetupForm(request.form) if form.validate(): + has_cache=False + for partition in form.partitions: + if partition.part_type.data == 'CACHE': + has_cache=True + if not has_cache: + flash(_(f'Missing cache partition'), category='error') + return redirect(url_for('commands')) + ips = form.ips.data.split(' ') payload = {'clients': ips, -- cgit v1.2.3-18-g5258