source: don't mark search_drivers required

In the source autoinstall section, the search_drivers key was marked
required. This made sense at the time when it was the only supported
key. However, now that we also support the source ID, we don't want
to force the user to supply search_drivers as well.

Signed-off-by: Olivier Gayot <olivier.gayot@canonical.com>
This commit is contained in:
Olivier Gayot 2022-08-03 13:56:08 +02:00
parent 0c73bf9b86
commit 566f32b01e
2 changed files with 2 additions and 10 deletions

View File

@ -127,10 +127,7 @@
"id": { "id": {
"type": "string" "type": "string"
} }
}, }
"required": [
"search_drivers"
]
}, },
"network": { "network": {
"oneOf": [ "oneOf": [

View File

@ -64,7 +64,6 @@ class SourceController(SubiquityController):
"type": "string", "type": "string",
}, },
}, },
"required": ["search_drivers"],
} }
# Defaults to true for backward compatibility with existing autoinstall # Defaults to true for backward compatibility with existing autoinstall
# configurations. Back then, then users were able to install third-party # configurations. Back then, then users were able to install third-party
@ -89,11 +88,7 @@ class SourceController(SubiquityController):
# "source: null" despite "type" being "object" # "source: null" despite "type" being "object"
data = {**self.autoinstall_default, "id": None} data = {**self.autoinstall_default, "id": None}
# search_drivers is marked required so the schema validator should self.model.search_drivers = data.get("search_drivers", True)
# reject any missing data.
assert "search_drivers" in data
self.model.search_drivers = data["search_drivers"]
# At this point, the model has not yet loaded the sources from the # At this point, the model has not yet loaded the sources from the
# catalog. So we store the data and lean on apply_autoinstall_config. # catalog. So we store the data and lean on apply_autoinstall_config.