From 1ffff94eff1e65fd36b87fc725dec29a58882c76 Mon Sep 17 00:00:00 2001 From: Olivier Gayot Date: Wed, 16 Mar 2022 16:19:31 +0100 Subject: [PATCH] drivers: show the drivers screen only if search drivers was checked Signed-off-by: Olivier Gayot --- subiquity/client/controllers/drivers.py | 8 ++++++-- subiquity/server/controllers/drivers.py | 8 ++++++++ subiquity/ui/views/drivers.py | 2 ++ 3 files changed, 16 insertions(+), 2 deletions(-) diff --git a/subiquity/client/controllers/drivers.py b/subiquity/client/controllers/drivers.py index 09d63d75..42d811bf 100644 --- a/subiquity/client/controllers/drivers.py +++ b/subiquity/client/controllers/drivers.py @@ -31,9 +31,13 @@ class DriversController(SubiquityTuiController): endpoint_name = 'drivers' async def make_ui(self) -> DriversView: - response: DriversResponse = await self.endpoint.GET() - if not response.drivers and response.drivers is not None: + source_endpoint = self.app.client.source + source_response = await source_endpoint.GET() + + if not source_response.search_drivers: raise Skip + + response: DriversResponse = await self.endpoint.GET() return DriversView(self, response.drivers, response.install) async def _wait_drivers(self) -> List[str]: diff --git a/subiquity/server/controllers/drivers.py b/subiquity/server/controllers/drivers.py index 96e6285d..4ac3c92b 100644 --- a/subiquity/server/controllers/drivers.py +++ b/subiquity/server/controllers/drivers.py @@ -74,6 +74,14 @@ class DriversController(SubiquityController): async def _list_drivers(self, context): with context.child("wait_apt"): await self._wait_apt.wait() + # The APT_CONFIGURED event (which unblocks _wait_apt.wait) is sent + # after the user confirms the destruction changes. At this point, the + # source is already mounted so the user can't go back all the way to + # the source screen to enable/disable the "search drivers" checkbox. + if not self.app.controllers.Source.model.search_drivers: + self.drivers = [] + await self.configured() + return apt = self.app.controllers.Mirror.apt_configurer async with apt.overlay() as d: try: diff --git a/subiquity/ui/views/drivers.py b/subiquity/ui/views/drivers.py index fa5ec9fa..1f4c430f 100644 --- a/subiquity/ui/views/drivers.py +++ b/subiquity/ui/views/drivers.py @@ -66,6 +66,8 @@ class DriversView(BaseView): if drivers is None: self.make_waiting(install) + elif not drivers: + self.make_no_drivers() else: self.make_main(install, drivers)