only do x-override-status: confirm games for first request for a screen
this uses a rather unsatisfactory way of identifying the first request for a screen. for https://bugs.launchpad.net/subiquity/+bug/1939176
This commit is contained in:
parent
d647c181f6
commit
755436ea45
|
@ -136,6 +136,8 @@ class SubiquityClient(TuiApplication):
|
|||
|
||||
self.conn = aiohttp.UnixConnector(self.opts.socket)
|
||||
self.client = make_client_for_conn(API, self.conn, self.resp_hook)
|
||||
self.client1 = make_client_for_conn(
|
||||
API, self.conn, self.resp_hook, headers={'x-first-request': 'yes'})
|
||||
|
||||
self.error_reporter = ErrorReporter(
|
||||
self.context.child("ErrorReporter"), self.opts.dry_run, self.root,
|
||||
|
|
|
@ -35,3 +35,4 @@ class SubiquityTuiController(TuiController):
|
|||
self.answers = app.answers.get(self.name, {})
|
||||
if self.endpoint_name is not None:
|
||||
self.endpoint = getattr(self.app.client, self.endpoint_name)
|
||||
self.endpoint1 = getattr(self.app.client1, self.endpoint_name)
|
||||
|
|
|
@ -55,7 +55,7 @@ class FilesystemController(SubiquityTuiController, FilesystemManipulator):
|
|||
self.answers.setdefault('manual', [])
|
||||
|
||||
async def make_ui(self):
|
||||
status = await self.endpoint.guided.GET()
|
||||
status = await self.endpoint1.guided.GET()
|
||||
if status.status == ProbeStatus.PROBING:
|
||||
self.app.aio_loop.create_task(self._wait_for_probing())
|
||||
return SlowProbing(self)
|
||||
|
|
|
@ -27,7 +27,7 @@ class IdentityController(SubiquityTuiController):
|
|||
endpoint_name = 'identity'
|
||||
|
||||
async def make_ui(self):
|
||||
data = await self.endpoint.GET()
|
||||
data = await self.endpoint1.GET()
|
||||
return IdentityView(self, data)
|
||||
|
||||
def run_answers(self):
|
||||
|
|
|
@ -28,7 +28,7 @@ class KeyboardController(SubiquityTuiController):
|
|||
endpoint_name = 'keyboard'
|
||||
|
||||
async def make_ui(self):
|
||||
setup = await self.endpoint.GET()
|
||||
setup = await self.endpoint1.GET()
|
||||
return KeyboardView(self, setup)
|
||||
|
||||
async def run_answers(self):
|
||||
|
|
|
@ -26,7 +26,7 @@ class MirrorController(SubiquityTuiController):
|
|||
endpoint_name = 'mirror'
|
||||
|
||||
async def make_ui(self):
|
||||
mirror = await self.endpoint.GET()
|
||||
mirror = await self.endpoint1.GET()
|
||||
return MirrorView(self, mirror)
|
||||
|
||||
def run_answers(self):
|
||||
|
|
|
@ -107,7 +107,7 @@ class NetworkController(SubiquityTuiController, NetworkAnswersMixin):
|
|||
shutil.rmtree(self.tdir)
|
||||
|
||||
async def make_ui(self):
|
||||
network_status = await self.endpoint.GET()
|
||||
network_status = await self.endpoint1.GET()
|
||||
self.view = NetworkView(
|
||||
self, network_status.devices,
|
||||
network_status.wlan_support_install_state.name)
|
||||
|
|
|
@ -26,7 +26,7 @@ class ProxyController(SubiquityTuiController):
|
|||
endpoint_name = 'proxy'
|
||||
|
||||
async def make_ui(self):
|
||||
proxy = await self.endpoint.GET()
|
||||
proxy = await self.endpoint1.GET()
|
||||
return ProxyView(self, proxy)
|
||||
|
||||
def run_answers(self):
|
||||
|
|
|
@ -54,7 +54,7 @@ class RefreshController(SubiquityTuiController):
|
|||
if self.app.updated:
|
||||
raise Skip()
|
||||
show = False
|
||||
self.status = await self.endpoint.GET()
|
||||
self.status = await self.endpoint1.GET()
|
||||
if index == 1:
|
||||
if self.status.availability == RefreshCheckState.AVAILABLE:
|
||||
show = True
|
||||
|
|
|
@ -26,7 +26,7 @@ class SerialController(SubiquityTuiController):
|
|||
async def make_ui(self):
|
||||
if not self.app.opts.run_on_serial:
|
||||
raise Skip()
|
||||
ssh_info = await self.app.client.meta.ssh_info.GET()
|
||||
ssh_info = await self.app.client1.meta.ssh_info.GET()
|
||||
return SerialView(self, ssh_info)
|
||||
|
||||
def run_answers(self):
|
||||
|
|
|
@ -37,7 +37,7 @@ class SnapListController(SubiquityTuiController):
|
|||
endpoint_name = 'snaplist'
|
||||
|
||||
async def make_ui(self):
|
||||
data = await self.endpoint.GET()
|
||||
data = await self.endpoint1.GET()
|
||||
if data.status == SnapCheckState.FAILED:
|
||||
# If loading snaps failed or the network is disabled, skip the
|
||||
# screen.
|
||||
|
|
|
@ -26,7 +26,7 @@ class SourceController(SubiquityTuiController):
|
|||
endpoint_name = 'source'
|
||||
|
||||
async def make_ui(self):
|
||||
sources = await self.endpoint.GET()
|
||||
sources = await self.endpoint1.GET()
|
||||
return SourceView(self, sources.sources, sources.current_id)
|
||||
|
||||
def run_answers(self):
|
||||
|
|
|
@ -47,7 +47,7 @@ class SSHController(SubiquityTuiController):
|
|||
'ssh-import-id']
|
||||
|
||||
async def make_ui(self):
|
||||
ssh_data = await self.endpoint.GET()
|
||||
ssh_data = await self.endpoint1.GET()
|
||||
return SSHView(self, ssh_data)
|
||||
|
||||
def run_answers(self):
|
||||
|
|
|
@ -30,7 +30,7 @@ class WelcomeController(SubiquityTuiController):
|
|||
async def make_ui(self):
|
||||
if not self.app.rich_mode:
|
||||
raise Skip()
|
||||
language = await self.endpoint.GET()
|
||||
language = await self.endpoint1.GET()
|
||||
i18n.switch_language(language)
|
||||
self.serial = self.app.opts.run_on_serial
|
||||
return WelcomeView(self, language, self.serial)
|
||||
|
|
|
@ -27,7 +27,7 @@ class ZdevController(SubiquityTuiController):
|
|||
endpoint_name = 'zdev'
|
||||
|
||||
async def make_ui(self):
|
||||
infos = await self.endpoint.GET()
|
||||
infos = await self.endpoint1.GET()
|
||||
return ZdevView(self, infos)
|
||||
|
||||
def run_answers(self):
|
||||
|
|
|
@ -67,11 +67,13 @@ def make_client(endpoint_cls, make_request, serializer=None):
|
|||
|
||||
|
||||
def make_client_for_conn(
|
||||
endpoint_cls, conn, resp_hook=lambda r: r, serializer=None):
|
||||
endpoint_cls, conn, resp_hook=lambda r: r, serializer=None,
|
||||
headers={}):
|
||||
@contextlib38.asynccontextmanager
|
||||
async def make_request(method, path, *, params, json):
|
||||
async with aiohttp.ClientSession(
|
||||
connector=conn, connector_owner=False) as session:
|
||||
connector=conn, connector_owner=False,
|
||||
headers=headers) as session:
|
||||
# session.request needs a full URL with scheme and host
|
||||
# even though that's in some ways a bit silly with a unix
|
||||
# socket, so we just hardcode something here (I guess the
|
||||
|
|
|
@ -407,7 +407,8 @@ class SubiquityServer(Application):
|
|||
if isinstance(controller, SubiquityController):
|
||||
if not controller.interactive():
|
||||
override_status = 'skip'
|
||||
elif self.state == ApplicationState.NEEDS_CONFIRMATION:
|
||||
elif (self.state == ApplicationState.NEEDS_CONFIRMATION and
|
||||
request.headers.get('x-first-request') == 'yes'):
|
||||
if self.base_model.is_postinstall_only(controller.model_name):
|
||||
override_status = 'confirm'
|
||||
if override_status is not None:
|
||||
|
|
Loading…
Reference in New Issue