system_setup: system setup API for Flutter UI part

This completes TODO "provide an API for this for the flutter UI to know
about it"

API is at /meta/client_variant with GET method, returns a string
This commit is contained in:
Patrick Wu 2021-09-02 23:47:37 +08:00
parent 78221ebf25
commit 018185af49
4 changed files with 8 additions and 3 deletions

View File

@ -78,6 +78,8 @@ class API:
class client_variant:
def POST(variant: str) -> None:
"""Choose the install variant - desktop/server"""
def GET() -> str:
"""Get the install variant - desktop/server"""
class confirm:
def POST(tty: str) -> None:

View File

@ -105,6 +105,8 @@ class SubiquityModel:
if root != '/':
self.target = root
self.client_variant = ''
self.debconf_selections = DebconfSelectionsModel()
self.filesystem = FilesystemModel()
self.identity = IdentityModel()
@ -135,6 +137,7 @@ class SubiquityModel:
self._postinstall_event = asyncio.Event()
def set_source_variant(self, variant):
self.client_variant = variant
self._cur_install_model_names = \
self._install_model_names.for_variant(variant)
self._cur_postinstall_model_names = \

View File

@ -124,6 +124,9 @@ class MetaController:
else:
self.app.base_model.set_source_variant(variant)
async def client_variant_GET(self) -> str:
return self.app.base_model.client_variant
async def ssh_info_GET(self) -> Optional[LiveSessionSSHInfo]:
ips = []
if self.app.base_model.network:

View File

@ -40,9 +40,6 @@ class SystemSetupClient(SubiquityClient):
]
def __init__(self, opts):
# TODO WSL:
# 3. provide an API for this for the flutter UI to know about it
if is_reconfigure(opts.dry_run):
self.variant = "wsl_configuration"
self.controllers = [