Improve autoinstall schema for third-party drivers

The autoinstall data for the drivers was only constituted of a boolean,
e.g.:

  drivers: true

or

  drivers: false

It was not immediately clear that the boolean value meant (install/don't
install the drivers).

We now store the boolean in the "install" sub-element instead, e.g.:

  drivers:
    - install: true

  drivers:
    - install: false

Signed-off-by: Olivier Gayot <olivier.gayot@canonical.com>
This commit is contained in:
Olivier Gayot 2022-02-02 15:54:54 +01:00
parent e26f35ad10
commit 43f71a02be
2 changed files with 18 additions and 5 deletions

View File

@ -396,7 +396,12 @@
} }
}, },
"drivers": { "drivers": {
"type": "boolean" "type": "object",
"properties": {
"install": {
"type": "boolean"
}
}
}, },
"timezone": { "timezone": {
"type": "string" "type": "string"

View File

@ -33,17 +33,25 @@ class DriversController(SubiquityController):
autoinstall_key = model_name = "drivers" autoinstall_key = model_name = "drivers"
autoinstall_schema = { autoinstall_schema = {
'type': 'boolean', 'type': 'object',
'properties': {
'install': {
'type': 'boolean',
},
},
} }
autoinstall_default = False autoinstall_default = {"install": False}
has_drivers = None has_drivers = None
def make_autoinstall(self): def make_autoinstall(self):
return self.model.do_install return {
"install": self.model.do_install,
}
def load_autoinstall_data(self, data): def load_autoinstall_data(self, data):
self.model.do_install = data if data is not None and "install" in data:
self.model.do_install = data["install"]
def start(self): def start(self):
self._wait_apt = asyncio.Event() self._wait_apt = asyncio.Event()