Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Guard better against RaidChooser's selected_level being None #440

Merged
merged 1 commit into from
Jun 6, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 7 additions & 3 deletions blivetgui/dialogs/add_dialog.py
Original file line number Diff line number Diff line change
Expand Up @@ -562,11 +562,12 @@ def raid_member_max_size(self):

device_type = self.selected_type
num_parents = self._get_number_selected_parents()
level = self._raid_chooser.selected_level

if device_type not in self.supported_raids.keys() or num_parents == 1:
return (False, None)

elif self._raid_chooser.selected_level.name in ("linear", "single"):
elif level and level.name in ("linear", "single"):
return (False, None)

else:
Expand Down Expand Up @@ -863,7 +864,8 @@ def add_advanced_options(self):
self.advanced.destroy()

if device_type in ("lvm", "lvmvg", "partition", "mdraid"):
if device_type == "mdraid" and self._raid_chooser.selected_level.name == "raid1":
level = self._raid_chooser.selected_level
if device_type == "mdraid" and level and level.name == "raid1":
self.advanced = None
self.widgets_dict["advanced"] = []
else:
Expand Down Expand Up @@ -1068,7 +1070,9 @@ def get_selection(self):
encryption_selection = self._encryption_chooser.get_selection()

if device_type in ("btrfs volume", "mdraid", "lvmlv"):
raid_level = self._raid_chooser.selected_level.name
raid_level = self._raid_chooser.selected_level
if raid_level:
raid_level = raid_level.name
else:
raid_level = None

Expand Down