mirror of https://git.48k.eu/ogcp
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.master
parent
8260cd0ac2
commit
7c86ecf9a1
|
@ -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']
|
||||
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)
|
||||
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'))
|
||||
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}",
|
||||
|
|
Loading…
Reference in New Issue