hub: mark baseurl as required in repo schema

Previously it the `repo` schema didn't mark the `baseurl` property as
required, although Cloud API "technically" requires it and the builder
code also made assumptions about it being always provided.

Note on Cloud API:
Cloud API requires that at least one of `baseurl`, `metalink` or
`mirrorlist` is specified for a repo. Since the plugin schema specifies
only `baseurl` as a property, it is as a result mandatory in order for
the Cloud API request to be valid and succeed.

Mark `baseurl` property as required in the `repo` schema and add unit
test for it.

Signed-off-by: Tomáš Hozza <thozza@redhat.com>
This commit is contained in:
Tomáš Hozza 2022-11-28 16:40:19 +01:00 committed by Ondřej Budai
parent 05b395c7db
commit 68ee7eedbe
2 changed files with 19 additions and 0 deletions

View file

@ -69,6 +69,7 @@ OSBUILD_IMAGE_SCHEMA = {
"title": "Repository options", "title": "Repository options",
"type": "object", "type": "object",
"additionalProperties": False, "additionalProperties": False,
"required": ["baseurl"],
"properties": { "properties": {
"baseurl": { "baseurl": {
"type": "string" "type": "string"

View file

@ -111,6 +111,24 @@ class TestHubPlugin(PluginTest):
["arches"] ["arches"]
], ],
"opts": {} "opts": {}
},
# repo without `baseurl` is not allowed
{
"args": [
"name",
"version",
"distro",
"image_type",
"target",
["arches"]
],
"opts": {
"repo": [
{
"package_sets": ["set1", "set2"]
}
]
}
} }
] ]