diff options
author | Alejandro Sirgo Rica <asirgo@soleta.eu> | 2024-09-26 14:45:04 +0200 |
---|---|---|
committer | Alejandro Sirgo Rica <asirgo@soleta.eu> | 2024-09-26 14:45:04 +0200 |
commit | 6feffeab5ddc1c8ba903a08015c8f36566d1eb30 (patch) | |
tree | 107b582e70f99550d3df1d74f2ecd876820f151b /ogcp | |
parent | 6fecb9d34b62cebcedfc082a3c71c15afb9bb4f0 (diff) |
views: ignore unsuported part types in /image/restore checks
Evaluate only the viable partitions for a restore operation
during checks for partition uniformity.
Diffstat (limited to 'ogcp')
-rw-r--r-- | ogcp/views.py | 18 |
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} " |