From 1594963ed578dcbb86ce3a68d4e07b881f86933a Mon Sep 17 00:00:00 2001 From: Michael Hudson-Doyle Date: Tue, 4 Jul 2023 17:01:41 +1200 Subject: [PATCH] remove guided_GET and associated types It does not really say good things that I didn't have to remove any tests... --- subiquity/common/types.py | 27 -------------- subiquity/server/controllers/filesystem.py | 41 ---------------------- 2 files changed, 68 deletions(-) diff --git a/subiquity/common/types.py b/subiquity/common/types.py index 41d1ad871..aee6b01e7 100644 --- a/subiquity/common/types.py +++ b/subiquity/common/types.py @@ -353,23 +353,6 @@ class GuidedDisallowedCapability: message: Optional[str] = None -@attr.s(auto_attribs=True) -class GuidedChoice: - disk_id: str - capability: GuidedCapability = GuidedCapability.DIRECT - password: Optional[str] = attr.ib(default=None, repr=False) - - -@attr.s(auto_attribs=True) -class GuidedStorageResponse: - status: ProbeStatus - error_report: Optional[ErrorReportRef] = None - disks: Optional[List[Disk]] = None - core_boot_classic_error: str = '' - encryption_unavailable_reason: str = '' - capabilities: List[GuidedCapability] = attr.Factory(list) - - @attr.s(auto_attribs=True) class StorageResponse: status: ProbeStatus @@ -468,16 +451,6 @@ class GuidedChoiceV2: attr.ib(default=SizingPolicy.SCALED) reset_partition: bool = False - @staticmethod - def from_guided_choice(choice: GuidedChoice): - return GuidedChoiceV2( - target=GuidedStorageTargetReformat( - disk_id=choice.disk_id, allowed=[choice.capability]), - capability=choice.capability, - password=choice.password, - sizing_policy=SizingPolicy.SCALED, - ) - @attr.s(auto_attribs=True) class GuidedStorageResponseV2: diff --git a/subiquity/server/controllers/filesystem.py b/subiquity/server/controllers/filesystem.py index 9a449686c..968b33ab1 100644 --- a/subiquity/server/controllers/filesystem.py +++ b/subiquity/server/controllers/filesystem.py @@ -65,7 +65,6 @@ GuidedChoiceV2, GuidedDisallowedCapability, GuidedDisallowedCapabilityReason, - GuidedStorageResponse, GuidedStorageResponseV2, GuidedStorageTarget, GuidedStorageTargetReformat, @@ -665,46 +664,6 @@ def potential_boot_disks(self, check_boot=True, with_reformatting=False): disks.append(disk) return [d for d in disks if d not in self.model._exclusions] - async def guided_GET(self, wait: bool = False) -> GuidedStorageResponse: - probe_resp = await self._probe_response(wait, GuidedStorageResponse) - if probe_resp is not None: - return probe_resp - disks = self.potential_boot_disks(with_reformatting=True) - - # Choose the first non-core-boot one offered. If we only have - # core-boot choices, choose the first of those. - core_boot_info = None - for info in self._variation_info.values(): - if not info.is_core_boot_classic(): - break - if core_boot_info is None: - core_boot_info = info - else: - info = core_boot_info - - if info.capability_info.allowed: - disks = [ - labels.for_client(d, min_size=info.min_size) for d in disks - ] - error = '' - else: - disks = [] - error = info.capability_info.disallowed[0].message - - encryption_unavailable_reason = '' - for disallowed_cap in info.capability_info.disallowed: - if disallowed_cap.capability == \ - GuidedCapability.CORE_BOOT_ENCRYPTED: - encryption_unavailable_reason = disallowed_cap.message - - return GuidedStorageResponse( - status=ProbeStatus.DONE, - error_report=self.full_probe_error(), - disks=disks, - core_boot_classic_error=error, - encryption_unavailable_reason=encryption_unavailable_reason, - capabilities=list(info.capability_info.allowed)) - def _offsets_and_sizes_for_volume(self, volume): offset = self.model._partition_alignment_data['gpt'].min_start_offset for structure in volume.structure: