Do not offer core boot based installs unless bootloader is UEFI

This commit is contained in:
Michael Hudson-Doyle 2023-08-29 14:04:04 +12:00
parent 3a2044593c
commit 9ff0a8b0ae
2 changed files with 30 additions and 0 deletions

View File

@ -375,6 +375,9 @@ class FilesystemController(SubiquityController, FilesystemManipulator):
if not self.app.opts.enhanced_secureboot:
log.debug("Not offering enhanced_secureboot: commandline disabled")
continue
if self.model.bootloader != Bootloader.UEFI:
log.debug("Not offering core boot based install: not a UEFI system")
continue
info = self.info_for_system(name, label, system)
if info is not None:
self._variation_info[name] = info

View File

@ -673,6 +673,33 @@ class TestCore(TestAPI):
with self.assertRaises(ClientResponseError):
await inst.post("/storage/v2/guided", data)
@timeout()
async def test_basic_no_core_boot_bios(self):
cfg = self.machineConfig("examples/machines/simple.json")
with cfg.edit() as data:
attrs = data["storage"]["blockdev"]["/dev/sda"]["attrs"]
attrs["size"] = str(25 << 30)
kw = dict(
bootloader="bios",
extra_args=[
"--storage-version",
"2",
"--source-catalog",
"examples/sources/install-canary.yaml",
"--dry-run-config",
"examples/dry-run-configs/tpm.yaml",
],
)
async with start_server(cfg, **kw) as inst:
await inst.post("/source", source_id="ubuntu-desktop")
resp = await inst.get("/storage/v2/guided", wait=True)
[reformat, manual] = resp["targets"]
for capability in reformat["allowed"]:
self.assertNotIn("CORE_BOOT", capability)
data = dict(target=reformat, capability="CORE_BOOT_ENCRYPTED")
with self.assertRaises(ClientResponseError):
await inst.post("/storage/v2/guided", data)
class TestAdd(TestAPI):
@timeout()