Skip to content

Commit

Permalink
remove guided_GET and associated types
Browse files Browse the repository at this point in the history
It does not really say good things that I didn't have to remove any
tests...
  • Loading branch information
mwhudson committed Jul 4, 2023
1 parent b95fd2e commit 1594963
Show file tree
Hide file tree
Showing 2 changed files with 0 additions and 68 deletions.
27 changes: 0 additions & 27 deletions subiquity/common/types.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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:
Expand Down
41 changes: 0 additions & 41 deletions subiquity/server/controllers/filesystem.py
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,6 @@
GuidedChoiceV2,
GuidedDisallowedCapability,
GuidedDisallowedCapabilityReason,
GuidedStorageResponse,
GuidedStorageResponseV2,
GuidedStorageTarget,
GuidedStorageTargetReformat,
Expand Down Expand Up @@ -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:
Expand Down

0 comments on commit 1594963

Please sign in to comment.