From b74e53679c6c56278e5a4832c2af0b49450699e9 Mon Sep 17 00:00:00 2001 From: Dan Bungert Date: Wed, 6 Jul 2022 16:09:02 -0600 Subject: [PATCH] boot: allow plans with None bootloader --- subiquity/common/filesystem/boot.py | 10 ++++++++++ subiquity/server/controllers/tests/test_filesystem.py | 2 +- 2 files changed, 11 insertions(+), 1 deletion(-) diff --git a/subiquity/common/filesystem/boot.py b/subiquity/common/filesystem/boot.py index f4222602..69db4413 100644 --- a/subiquity/common/filesystem/boot.py +++ b/subiquity/common/filesystem/boot.py @@ -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') diff --git a/subiquity/server/controllers/tests/test_filesystem.py b/subiquity/server/controllers/tests/test_filesystem.py index c8aa89f7..d5e7e265 100644 --- a/subiquity/server/controllers/tests/test_filesystem.py +++ b/subiquity/server/controllers/tests/test_filesystem.py @@ -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')]