summaryrefslogtreecommitdiffstats
path: root/ogcp
diff options
context:
space:
mode:
Diffstat (limited to 'ogcp')
-rw-r--r--ogcp/views.py37
1 files changed, 18 insertions, 19 deletions
diff --git a/ogcp/views.py b/ogcp/views.py
index bf30e0f..f0049fc 100644
--- a/ogcp/views.py
+++ b/ogcp/views.py
@@ -783,25 +783,24 @@ def action_image_restore():
if r.status_code != requests.codes.ok:
return ogserver_error('commands')
- if r.status_code == requests.codes.ok:
- partitions = r.json()['partitions']
- parts = []
- for partition in partitions:
- disk_id = partition['disk']
- part_id = partition['partition']
- if part_id == 0: # This is the disk data, not a partition.
- continue
- part_code = partition['code']
- filesystem = partition['filesystem']
-
- choice_value = (disk_id, part_id, part_code, filesystem)
- parts.append(choice_value)
-
- 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'))
+ partitions = r.json()['partitions']
+ parts = []
+ for partition in partitions:
+ disk_id = partition['disk']
+ part_id = partition['partition']
+ if part_id == 0: # This is the disk data, not a partition.
+ continue
+ part_code = partition['code']
+ filesystem = partition['filesystem']
+
+ choice_value = (disk_id, part_id, part_code, filesystem)
+ parts.append(choice_value)
+
+ 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'))
form.partition.choices = [
(f"{disk_id} {part_id}",