summaryrefslogtreecommitdiffstats
path: root/ogcp
diff options
context:
space:
mode:
authorAlejandro Sirgo Rica <asirgo@soleta.eu>2024-07-17 12:54:46 +0200
committerAlejandro Sirgo Rica <asirgo@soleta.eu>2024-07-17 13:17:58 +0200
commit33d4c31f462e1e20f537908de3e516a0451a4dbe (patch)
tree34f59416dd9302e5140c60bed127125e315925f1 /ogcp
parentea28a4baf15cfdaa2e2d954a31a8540379bee83a (diff)
views: exclude clients with no partition in image/restore1.1.3-25
Clients cannot have an image restore when no partition configuration is available. Shown an error listing all the clients with no partitions.
Diffstat (limited to 'ogcp')
-rw-r--r--ogcp/views.py11
1 files changed, 11 insertions, 0 deletions
diff --git a/ogcp/views.py b/ogcp/views.py
index 875d0ec..4bd1eae 100644
--- a/ogcp/views.py
+++ b/ogcp/views.py
@@ -943,6 +943,7 @@ def action_image_restore():
form.image.choices.append((image['id'], image['name']))
part_choices = []
+ empty_clients = []
for ip in ips:
r = server.get('/client/setup', payload={'client': [ip]})
if not r:
@@ -968,12 +969,22 @@ def action_image_restore():
choice_value = (disk_id, part_id, part_code, filesystem, part_size)
parts.append(choice_value)
+ if not parts:
+ empty_clients.append(ip)
+
+ if empty_clients:
+ continue
+
if not part_choices: # Use first computer as reference part setup conf
part_choices = [part for part in parts]
elif part_choices != parts:
flash(_(f'Computers have different partition setup'), category='error')
return redirect(url_for('commands'))
+ if empty_clients:
+ flash(_(f'The following clients have not partitions: {" ".join(empty_clients)}'), category='error')
+ return redirect(url_for('commands'))
+
invalid_part_types = get_invalid_image_partition_types()
for disk_id, part_id, part_code, filesystem, part_size in part_choices: