boot: allow plans with None bootloader

This commit is contained in:
Dan Bungert 2022-07-06 16:09:02 -06:00
parent b895fba66a
commit b74e53679c
2 changed files with 11 additions and 1 deletions

View File

@ -142,6 +142,14 @@ class MountBootEfiPlan(MakeBootDevicePlan):
manipulator._mount_esp(self.part)
@attr.s(auto_attribs=True)
class NoOpBootPlan(MakeBootDevicePlan):
"""Do nothing, successfully"""
def apply(self, manipulator):
pass
@attr.s(auto_attribs=True)
class MultiStepPlan(MakeBootDevicePlan):
"""Execute several MakeBootDevicePlans in sequence."""
@ -296,6 +304,8 @@ def get_boot_device_plan(device, resize_partition=None):
return get_boot_device_plan_uefi(device, resize_partition)
if bl == Bootloader.PREP:
return get_boot_device_plan_prep(device, resize_partition)
if bl == Bootloader.NONE:
return NoOpBootPlan()
raise Exception(f'unexpected bootloader {bl} here')

View File

@ -139,7 +139,7 @@ class TestLayout(TestCase):
bootloaders_and_ptables = [(bl, pt)
for bl in list(Bootloader) if bl != Bootloader.NONE
for bl in list(Bootloader)
for pt in ('gpt', 'msdos', 'vtoc')]