summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorOpenGnSys Support Team <soporte-og@soleta.eu>2024-01-25 12:43:28 +0100
committerOpenGnSys Support Team <soporte-og@soleta.eu>2024-01-25 12:44:27 +0100
commit7c86ecf9a1280d6994527bfb970e45a9f181549a (patch)
treeef24997c2499ba9e69de256a9e61a09fed3e4e20
parent8260cd0ac22641800f23e58ae05dabd2d207e27a (diff)
views: remove one level of indentation in action_image_restore
r.status_code == requests.codes.ok is redundant, already checked for error, remove this check and save one level of indentation.
-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}",