Skip to content

Commit

Permalink
Always show "Select Primary Disk" screen (fixes #7)
Browse files Browse the repository at this point in the history
Skipping the primary disk slection when there is only one caused
several problems:

- hitting "Back" from "Virtual Machine Storage" screen tries to get
  back to primary disk selection, and finally has no effect
- users are sometimes confusing the disk selection for VM storage
  with the selection of primary disk

Signed-off-by: Yann Dirson <yann.dirson@vates.fr>
  • Loading branch information
ydirson authored and benjamreis committed Jun 15, 2023
1 parent a220bcf commit 116df4e
Showing 1 changed file with 16 additions and 20 deletions.
36 changes: 16 additions & 20 deletions tui/installer/screens.py
Original file line number Diff line number Diff line change
Expand Up @@ -569,32 +569,28 @@ def select_primary_disk(answers):
['Cancel'])
return EXIT

# if only one disk, set default:
if len(entries) == 1:
answers['primary-disk'] = entries[0][1]
else:
# default value:
default = None
if 'primary-disk' in answers:
default = selectDefault(answers['primary-disk'], entries)
# default value:
default = None
if 'primary-disk' in answers:
default = selectDefault(answers['primary-disk'], entries)

tui.update_help_line([None, "<F5> more info"])
tui.update_help_line([None, "<F5> more info"])

scroll, height = snackutil.scrollHeight(4, len(entries))
(button, entry) = snackutil.ListboxChoiceWindowEx(
tui.screen,
"Select Primary Disk",
"""Please select the disk you would like to install %s on (disks with insufficient space are not shown).
scroll, height = snackutil.scrollHeight(4, len(entries))
(button, entry) = snackutil.ListboxChoiceWindowEx(
tui.screen,
"Select Primary Disk",
"""Please select the disk you would like to install %s on (disks with insufficient space are not shown).
You may need to change your system settings to boot from this disk.""" % (MY_PRODUCT_BRAND),
entries,
['Ok', 'Back'], 55, scroll, height, default, help='pridisk:info',
hotkeys={'F5': disk_more_info})
entries,
['Ok', 'Back'], 55, scroll, height, default, help='pridisk:info',
hotkeys={'F5': disk_more_info})

tui.screen.popHelpLine()
tui.screen.popHelpLine()

# entry contains the 'de' part of the tuple passed in
answers['primary-disk'] = entry
# entry contains the 'de' part of the tuple passed in
answers['primary-disk'] = entry

if 'installation-to-overwrite' in answers:
answers['target-is-sr'] = target_is_sr[answers['primary-disk']]
Expand Down

0 comments on commit 116df4e

Please sign in to comment.