diff --git a/ogcp/templates/actions/image_create.html b/ogcp/templates/actions/image_create.html index c607b97..024aeb8 100644 --- a/ogcp/templates/actions/image_create.html +++ b/ogcp/templates/actions/image_create.html @@ -12,6 +12,9 @@ {{ macros.cmd_selected_clients(selected_clients) }} +{% set partition_field_id = 'os' %} +{% include 'partition_warning.html' %} + {{ wtf.quick_form(form, action=url_for('action_image_create'), method='post', diff --git a/ogcp/templates/actions/image_restore.html b/ogcp/templates/actions/image_restore.html index f8a9e78..5db1e5b 100644 --- a/ogcp/templates/actions/image_restore.html +++ b/ogcp/templates/actions/image_restore.html @@ -17,6 +17,9 @@ {{ macros.cmd_selected_clients(selected_clients) }} +{% set partition_field_id = 'partition' %} +{% include 'partition_warning.html' %} + {{ wtf.quick_form(form, action=url_for('action_image_restore'), method='post', diff --git a/ogcp/templates/actions/image_update.html b/ogcp/templates/actions/image_update.html index 352b0d0..d8c50ed 100644 --- a/ogcp/templates/actions/image_update.html +++ b/ogcp/templates/actions/image_update.html @@ -13,6 +13,9 @@ {{ macros.cmd_selected_clients(selected_clients) }} +{% set partition_field_id = 'os' %} +{% include 'partition_warning.html' %} +
{{ form.hidden_tag() }} diff --git a/ogcp/templates/partition_warning.html b/ogcp/templates/partition_warning.html new file mode 100644 index 0000000..e1c3e79 --- /dev/null +++ b/ogcp/templates/partition_warning.html @@ -0,0 +1,30 @@ + + + \ No newline at end of file diff --git a/ogcp/views.py b/ogcp/views.py index e98243b..d31538c 100644 --- a/ogcp/views.py +++ b/ogcp/views.py @@ -1084,8 +1084,6 @@ def action_image_restore(): part_id = partition['partition'] if part_id == 0: # This is the disk data, not a partition. continue - if disk_id != 1: - continue part_code = partition['code'] part_type = PART_TYPE_CODES.get(int(part_code), 'UNKNOWN') @@ -2372,13 +2370,14 @@ def action_image_create(): invalid_part_types = get_invalid_image_partition_types() - for part in r.json()['partitions'][1:]: + for part in r.json()['partitions']: part_type = PART_TYPE_CODES.get(int(part.get('code')), 'UNKNOWN') - if part_type in invalid_part_types: + part_id = part['partition'] + if part_id == 0: # This is the disk data, not a partition. continue - if part.get('disk') != 1: + if part_type in invalid_part_types: continue form.os.choices.append( @@ -2467,15 +2466,16 @@ def action_image_update(): invalid_part_types = get_invalid_image_partition_types() part_content = {} - for part in r.json()['partitions'][1:]: + for part in r.json()['partitions']: part_type = PART_TYPE_CODES.get(int(part.get('code')), 'UNKNOWN') + part_id = part['partition'] + if part_id == 0: # This is the disk data, not a partition. + continue + if part_type in invalid_part_types: continue - if part.get('disk') != 1: - continue - partition_value = f"{part.get('disk')} {part.get('partition')} {part.get('code')}" partition_text = f"Disk {part.get('disk')} | Partition {part.get('partition')} " f"| {PART_TYPE_CODES.get(part.get('code'), 'UNKNOWN')} "