type out some schema stuff

This commit is contained in:
Michael Hudson-Doyle 2020-03-25 17:35:44 +13:00
parent c87e8a15d6
commit 75f29cee70
6 changed files with 38 additions and 1 deletions

View File

@ -21,6 +21,10 @@ from subiquity.controller import NoUIController
class CmdListController(NoUIController):
autoinstall_default = []
autoinstall_schema = {
'type': 'array',
'items': {'type': 'string'},
}
cmds = ()
def load_autoinstall_data(self, data):

View File

@ -36,7 +36,7 @@ from subiquitycore.async_helpers import (
schedule_task,
)
from subiquity.controller import NoUIController
from subiquity.controllers.cmdlist import CmdListController
log = logging.getLogger('subiquity.controllers.error')
@ -323,6 +323,8 @@ class ErrorReport(metaclass=urwid.MetaSignals):
class ErrorController(NoUIController):
autoinstall_key = 'error-commands'
def __init__(self, app):
super().__init__(app)
self.crash_directory = os.path.join(self.app.root, 'var/crash')

View File

@ -64,6 +64,7 @@ UEFI_GRUB_SIZE_BYTES = 512 * 1024 * 1024 # 512MiB EFI partition
class FilesystemController(SubiquityController):
autoinstall_key = "storage"
autoinstall_schema = {'type': 'object'} # ...
model_name = "filesystem"
def __init__(self, app):

View File

@ -26,6 +26,17 @@ log = logging.getLogger('subiquity.controllers.identity')
class IdentityController(SubiquityController):
autoinstall_key = model_name = "identity"
autoinstall_schema = {
'type': 'object',
'properties': {
'realname': {'type': 'string'},
'username': {'type': 'string'},
'hostname': {'type': 'string'},
'password': {'type': 'string'},
},
'requiredProperties': ['username', 'hostname', 'password'],
'additionalProperties': False,
}
def load_autoinstall_data(self, data):
if data is not None:

View File

@ -29,6 +29,16 @@ log = logging.getLogger('subiquity.controllers.keyboard')
class KeyboardController(SubiquityController):
autoinstall_key = model_name = "keyboard"
autoinstall_schema = {
'type': 'object',
'properties': {
'layout': {'type': 'string'},
'variant': {'type': 'string'},
'toggle': {'type': 'string'},
},
'requiredProperties': ['layout'],
'additionalProperties': False,
}
signals = [
('l10n:language-selected', 'language_selected'),
]

View File

@ -42,6 +42,15 @@ class CheckState(enum.IntEnum):
class MirrorController(SubiquityController):
autoinstall_key = "apt"
autoinstall_schema = { # This is obviously incomplete.
'type': 'object',
'properties': {
'preserve_sources_list': {'type': 'boolean'},
'primary': {'type': 'array'},
'geoip': {'type': 'boolean'},
'sources': {'type': 'object'},
},
}
model_name = "mirror"
signals = [
('snapd-network-change', 'snapd_network_changed'),