meta: add interactive_sections endpoint
A feature request for Desktop was to add the ability to retrieve, all at once, the raw interactive-sections value from autoinstall.
This commit is contained in:
parent
7e41eee464
commit
e4c94780b6
|
@ -135,6 +135,9 @@ class API:
|
||||||
the list of components. free-only choice must be made prior to
|
the list of components. free-only choice must be made prior to
|
||||||
confirmation of filesystem changes"""
|
confirmation of filesystem changes"""
|
||||||
|
|
||||||
|
class interactive_sections:
|
||||||
|
def GET() -> Optional[List[str]]: ...
|
||||||
|
|
||||||
class errors:
|
class errors:
|
||||||
class wait:
|
class wait:
|
||||||
def GET(error_ref: ErrorReportRef) -> ErrorReportRef:
|
def GET(error_ref: ErrorReportRef) -> ErrorReportRef:
|
||||||
|
|
|
@ -178,6 +178,11 @@ class MetaController:
|
||||||
# enabling free only mode means disabling components
|
# enabling free only mode means disabling components
|
||||||
self.app.base_model.mirror.disable_components(to_disable, enable)
|
self.app.base_model.mirror.disable_components(to_disable, enable)
|
||||||
|
|
||||||
|
async def interactive_sections_GET(self) -> Optional[List[str]]:
|
||||||
|
if self.app.autoinstall_config is None:
|
||||||
|
return None
|
||||||
|
return self.app.autoinstall_config.get('interactive-sections', None)
|
||||||
|
|
||||||
|
|
||||||
def get_installer_password_from_cloudinit_log():
|
def get_installer_password_from_cloudinit_log():
|
||||||
try:
|
try:
|
||||||
|
|
|
@ -19,7 +19,9 @@ from unittest.mock import Mock
|
||||||
|
|
||||||
from subiquitycore.utils import run_command
|
from subiquitycore.utils import run_command
|
||||||
from subiquitycore.tests import SubiTestCase
|
from subiquitycore.tests import SubiTestCase
|
||||||
|
from subiquitycore.tests.mocks import make_app
|
||||||
from subiquity.server.server import (
|
from subiquity.server.server import (
|
||||||
|
MetaController,
|
||||||
SubiquityServer,
|
SubiquityServer,
|
||||||
cloud_autoinstall_path,
|
cloud_autoinstall_path,
|
||||||
iso_autoinstall_path,
|
iso_autoinstall_path,
|
||||||
|
@ -121,3 +123,25 @@ early-commands: ["{cmd}"]
|
||||||
'early-commands': [cmd],
|
'early-commands': [cmd],
|
||||||
'stuff': 'things'}
|
'stuff': 'things'}
|
||||||
self.assertEqual(after_early, self.server.autoinstall_config)
|
self.assertEqual(after_early, self.server.autoinstall_config)
|
||||||
|
|
||||||
|
|
||||||
|
class TestMetaController(SubiTestCase):
|
||||||
|
async def test_interactive_sections_not_present(self):
|
||||||
|
mc = MetaController(make_app())
|
||||||
|
mc.app.autoinstall_config = None
|
||||||
|
self.assertIsNone(await mc.interactive_sections_GET())
|
||||||
|
|
||||||
|
async def test_interactive_sections_empty(self):
|
||||||
|
mc = MetaController(make_app())
|
||||||
|
mc.app.autoinstall_config['interactive-sections'] = []
|
||||||
|
self.assertEqual([], await mc.interactive_sections_GET())
|
||||||
|
|
||||||
|
async def test_interactive_sections_all(self):
|
||||||
|
mc = MetaController(make_app())
|
||||||
|
mc.app.autoinstall_config['interactive-sections'] = ['*']
|
||||||
|
self.assertEqual(['*'], await mc.interactive_sections_GET())
|
||||||
|
|
||||||
|
async def test_interactive_sections_one(self):
|
||||||
|
mc = MetaController(make_app())
|
||||||
|
mc.app.autoinstall_config['interactive-sections'] = ['network']
|
||||||
|
self.assertEqual(['network'], await mc.interactive_sections_GET())
|
||||||
|
|
Loading…
Reference in New Issue