disallow core boot options if searching for drivers

This commit is contained in:
Michael Hudson-Doyle 2023-09-04 16:34:38 +12:00
parent c03f0ba4f4
commit 2306703918
3 changed files with 19 additions and 1 deletions

View File

@ -388,6 +388,7 @@ class GuidedDisallowedCapabilityReason(enum.Enum):
TOO_SMALL = enum.auto() TOO_SMALL = enum.auto()
CORE_BOOT_ENCRYPTION_UNAVAILABLE = enum.auto() CORE_BOOT_ENCRYPTION_UNAVAILABLE = enum.auto()
NOT_UEFI = enum.auto() NOT_UEFI = enum.auto()
THIRD_PARTY_DRIVERS = enum.auto()
@attr.s(auto_attribs=True) @attr.s(auto_attribs=True)

View File

@ -419,7 +419,23 @@ class FilesystemController(SubiquityController, FilesystemManipulator):
info.capability_info.disallow_if( info.capability_info.disallow_if(
lambda cap: cap.is_core_boot(), lambda cap: cap.is_core_boot(),
GuidedDisallowedCapabilityReason.NOT_UEFI, GuidedDisallowedCapabilityReason.NOT_UEFI,
"Enhanced secure boot options only available on UEFI systems.", _(
"Enhanced secure boot options only available on UEFI "
"systems."
),
)
if self.app.base_model.source.search_drivers:
log.debug(
"Disabling core boot based install options as third-party "
"drivers selected"
)
info.capability_info.disallow_if(
lambda cap: cap.is_core_boot(),
GuidedDisallowedCapabilityReason.THIRD_PARTY_DRIVERS,
_(
"Enhanced secure boot options cannot currently install "
"third party drivers."
),
) )
self._variation_info[name] = info self._variation_info[name] = info
elif catalog_entry.type.startswith("dd-"): elif catalog_entry.type.startswith("dd-"):

View File

@ -1144,6 +1144,7 @@ class TestCoreBootInstallMethods(IsolatedAsyncioTestCase):
self.app.dr_cfg = DRConfig() self.app.dr_cfg = DRConfig()
self.app.dr_cfg.systems_dir_exists = True self.app.dr_cfg.systems_dir_exists = True
self.app.controllers.Source.get_handler.return_value = TrivialSourceHandler("") self.app.controllers.Source.get_handler.return_value = TrivialSourceHandler("")
self.app.base_model.source.search_drivers = False
self.fsc = FilesystemController(app=self.app) self.fsc = FilesystemController(app=self.app)
self.fsc._configured = True self.fsc._configured = True
self.fsc.model = make_model(Bootloader.UEFI) self.fsc.model = make_model(Bootloader.UEFI)