pass encryption information to subiquity client
and skip storage editing screen if it is present.
This commit is contained in:
parent
1ef6267b54
commit
952811fa14
|
@ -23,7 +23,11 @@ from subiquitycore.view import BaseView
|
|||
from subiquity.client.controller import SubiquityTuiController
|
||||
from subiquity.common.filesystem import gaps
|
||||
from subiquity.common.filesystem.manipulator import FilesystemManipulator
|
||||
from subiquity.common.types import ProbeStatus
|
||||
from subiquity.common.types import (
|
||||
ProbeStatus,
|
||||
StorageEncryption,
|
||||
StorageEncryptionSupport,
|
||||
)
|
||||
from subiquity.models.filesystem import (
|
||||
Bootloader,
|
||||
FilesystemModel,
|
||||
|
@ -53,6 +57,7 @@ class FilesystemController(SubiquityTuiController, FilesystemManipulator):
|
|||
self.answers.setdefault('guided-index', 0)
|
||||
self.answers.setdefault('manual', [])
|
||||
self.current_view: Optional[BaseView] = None
|
||||
self.storage_encryption: Optional[StorageEncryption] = None
|
||||
|
||||
async def make_ui(self) -> Callable[[], BaseView]:
|
||||
def get_current_view() -> BaseView:
|
||||
|
@ -85,6 +90,9 @@ class FilesystemController(SubiquityTuiController, FilesystemManipulator):
|
|||
self.ui.body)
|
||||
|
||||
def make_guided_ui(self, status):
|
||||
se = self.storage_encryption = status.storage_encryption
|
||||
if se is not None and se.support == StorageEncryptionSupport.DEFECTIVE:
|
||||
1/0 # should show an error page here
|
||||
if status.status == ProbeStatus.FAILED:
|
||||
self.app.show_error_report(status.error_report)
|
||||
return ProbingFailed(self, status.error_report)
|
||||
|
@ -236,6 +244,9 @@ class FilesystemController(SubiquityTuiController, FilesystemManipulator):
|
|||
raise Exception("could not process action {}".format(action))
|
||||
|
||||
async def _guided_choice(self, choice):
|
||||
if self.storage_encryption is not None:
|
||||
self.app.next_screen(self.endpoint.guided.POST(choice))
|
||||
return
|
||||
# FIXME It would seem natural here to pass the wait=true flag to the
|
||||
# below HTTP calls, especially because we wrap the coroutine in
|
||||
# wait_with_progress.
|
||||
|
|
|
@ -355,6 +355,7 @@ class GuidedStorageResponse:
|
|||
status: ProbeStatus
|
||||
error_report: Optional[ErrorReportRef] = None
|
||||
disks: Optional[List[Disk]] = None
|
||||
storage_encryption: Optional[StorageSafety] = None
|
||||
|
||||
|
||||
@attr.s(auto_attribs=True)
|
||||
|
|
|
@ -368,14 +368,23 @@ class FilesystemController(SubiquityController, FilesystemManipulator):
|
|||
# size?)
|
||||
min_size = 2*self.app.base_model.source.current.size + (1 << 30)
|
||||
disks = self.get_guided_disks(with_reformatting=True)
|
||||
se = None
|
||||
if self._system is not None:
|
||||
se = self._system.storage_encryption
|
||||
return GuidedStorageResponse(
|
||||
status=ProbeStatus.DONE,
|
||||
error_report=self.full_probe_error(),
|
||||
disks=[labels.for_client(d, min_size=min_size) for d in disks])
|
||||
disks=[labels.for_client(d, min_size=min_size) for d in disks],
|
||||
storage_encryption=se)
|
||||
|
||||
async def guided_POST(self, data: GuidedChoice) -> StorageResponse:
|
||||
log.debug(data)
|
||||
self.guided(GuidedChoiceV2.from_guided_choice(data))
|
||||
if self._system is not None:
|
||||
# Here is where we will apply the gadget info from the
|
||||
# system to the disk!
|
||||
await self.configured()
|
||||
else:
|
||||
self.guided(GuidedChoiceV2.from_guided_choice(data))
|
||||
return self._done_response()
|
||||
|
||||
async def reset_POST(self, context, request) -> StorageResponse:
|
||||
|
|
Loading…
Reference in New Issue