create a method for indicating if a capability can be customized

Currently the only capability that cannot be customized are the core
boot ones, but (a) that will change (b) it obscures the intent of the
check.
This commit is contained in:
Michael Hudson-Doyle 2023-07-06 14:36:36 +12:00
parent a97909cdd5
commit c554428512
3 changed files with 10 additions and 2 deletions

View File

@ -300,7 +300,7 @@ class FilesystemController(SubiquityTuiController, FilesystemManipulator):
# before the kinetic release. This is also similar to what we did for # before the kinetic release. This is also similar to what we did for
# https://launchpad.net/bugs/1962205 # https://launchpad.net/bugs/1962205
coro = self.endpoint.guided.POST(choice) coro = self.endpoint.guided.POST(choice)
if self.core_boot_capability is not None: if not choice.capability.supports_manual_customization():
self.app.next_screen(coro) self.app.next_screen(coro)
return return
status = await self.app.wait_with_progress(coro) status = await self.app.wait_with_progress(coro)

View File

@ -341,6 +341,14 @@ class GuidedCapability(enum.Enum):
GuidedCapability.CORE_BOOT_PREFER_ENCRYPTED, GuidedCapability.CORE_BOOT_PREFER_ENCRYPTED,
GuidedCapability.CORE_BOOT_PREFER_UNENCRYPTED] GuidedCapability.CORE_BOOT_PREFER_UNENCRYPTED]
def supports_manual_customization(self) -> bool:
# After posting this capability to guided_POST, is it possible
# for the user to customize the layout further?
return self in [GuidedCapability.MANUAL,
GuidedCapability.DIRECT,
GuidedCapability.LVM,
GuidedCapability.LVM_LUKS]
class GuidedDisallowedCapabilityReason(enum.Enum): class GuidedDisallowedCapabilityReason(enum.Enum):
TOO_SMALL = enum.auto() TOO_SMALL = enum.auto()

View File

@ -788,7 +788,7 @@ class FilesystemController(SubiquityController, FilesystemManipulator):
async def guided_POST(self, data: GuidedChoiceV2) -> StorageResponse: async def guided_POST(self, data: GuidedChoiceV2) -> StorageResponse:
log.debug(data) log.debug(data)
await self.guided(data) await self.guided(data)
if data.capability.is_core_boot(): if not data.capability.supports_manual_customization():
await self.configured() await self.configured()
return self._done_response() return self._done_response()