From 43f71a02be700a9599be6353ac9bab710a1a08e0 Mon Sep 17 00:00:00 2001 From: Olivier Gayot Date: Wed, 2 Feb 2022 15:54:54 +0100 Subject: [PATCH] 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 --- autoinstall-schema.json | 7 ++++++- subiquity/server/controllers/drivers.py | 16 ++++++++++++---- 2 files changed, 18 insertions(+), 5 deletions(-) diff --git a/autoinstall-schema.json b/autoinstall-schema.json index 69a402a9..cd950b54 100644 --- a/autoinstall-schema.json +++ b/autoinstall-schema.json @@ -396,7 +396,12 @@ } }, "drivers": { - "type": "boolean" + "type": "object", + "properties": { + "install": { + "type": "boolean" + } + } }, "timezone": { "type": "string" diff --git a/subiquity/server/controllers/drivers.py b/subiquity/server/controllers/drivers.py index 5932d826..7b64e37d 100644 --- a/subiquity/server/controllers/drivers.py +++ b/subiquity/server/controllers/drivers.py @@ -33,17 +33,25 @@ class DriversController(SubiquityController): autoinstall_key = model_name = "drivers" autoinstall_schema = { - 'type': 'boolean', + 'type': 'object', + 'properties': { + 'install': { + 'type': 'boolean', + }, + }, } - autoinstall_default = False + autoinstall_default = {"install": False} has_drivers = None def make_autoinstall(self): - return self.model.do_install + return { + "install": self.model.do_install, + } 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): self._wait_apt = asyncio.Event()