mirror of https://git.48k.eu/ogcp
views: ensure only one cache partition is defined
Add validation for the case where the user defines more than one CACHE partition in the Partition and Format form.master
parent
6034ba2537
commit
17f8b25fe5
|
@ -642,14 +642,18 @@ def action_setup_show():
|
|||
def action_setup_modify():
|
||||
form = SetupForm(request.form)
|
||||
if form.validate():
|
||||
has_cache=False
|
||||
cache_count = 0
|
||||
for partition in form.partitions:
|
||||
if partition.part_type.data == 'CACHE':
|
||||
has_cache=True
|
||||
if not has_cache:
|
||||
cache_count += 1
|
||||
if cache_count == 0:
|
||||
flash(_(f'Missing cache partition'), category='error')
|
||||
return redirect(url_for('commands'))
|
||||
|
||||
if cache_count > 1:
|
||||
flash(_(f'More than one cache partition is not supported'), category='error')
|
||||
return redirect(url_for('commands'))
|
||||
|
||||
ips = form.ips.data.split(' ')
|
||||
|
||||
payload = {'clients': ips,
|
||||
|
|
Loading…
Reference in New Issue