summaryrefslogtreecommitdiffstats
path: root/ogcp/views.py
diff options
context:
space:
mode:
Diffstat (limited to 'ogcp/views.py')
-rw-r--r--ogcp/views.py18
1 files changed, 10 insertions, 8 deletions
diff --git a/ogcp/views.py b/ogcp/views.py
index b6a0cd7..c890782 100644
--- a/ogcp/views.py
+++ b/ogcp/views.py
@@ -1082,6 +1082,9 @@ def action_image_restore():
part_choices = []
empty_clients = []
+
+ invalid_part_types = get_invalid_image_partition_types()
+
for ip in ips:
r = server.get('/client/setup', payload={'client': [ip]})
if not r:
@@ -1101,8 +1104,14 @@ def action_image_restore():
if disk_id != 1:
continue
part_code = partition['code']
- if PART_TYPE_CODES.get(int(part_code), 'UNKNOWN') == 'CACHE':
+ part_type = PART_TYPE_CODES.get(int(part_code), 'UNKNOWN')
+
+ if part_type == 'CACHE':
has_cache = True
+
+ if part_type in invalid_part_types:
+ continue
+
filesystem = partition['filesystem']
part_size = partition['size']
@@ -1125,14 +1134,7 @@ def action_image_restore():
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:
- part_type = PART_TYPE_CODES.get(int(part_code), 'UNKNOWN')
-
- if part_type in invalid_part_types:
- continue
-
form.partition.choices.append(
(f"{disk_id} {part_id} {part_code} {part_size} {has_cache}",
f"Disk {disk_id} | Partition {part_id} "