From 68ee7eedbe9da20514345247f4377d7c516a1cac Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tom=C3=A1=C5=A1=20Hozza?= Date: Mon, 28 Nov 2022 16:40:19 +0100 Subject: [PATCH] hub: mark `baseurl` as required in `repo` schema MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 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 --- plugins/hub/osbuild.py | 1 + test/unit/test_hub.py | 18 ++++++++++++++++++ 2 files changed, 19 insertions(+) diff --git a/plugins/hub/osbuild.py b/plugins/hub/osbuild.py index 2b2d109..b280bbe 100644 --- a/plugins/hub/osbuild.py +++ b/plugins/hub/osbuild.py @@ -69,6 +69,7 @@ OSBUILD_IMAGE_SCHEMA = { "title": "Repository options", "type": "object", "additionalProperties": False, + "required": ["baseurl"], "properties": { "baseurl": { "type": "string" diff --git a/test/unit/test_hub.py b/test/unit/test_hub.py index 65c10b7..e00351c 100644 --- a/test/unit/test_hub.py +++ b/test/unit/test_hub.py @@ -111,6 +111,24 @@ class TestHubPlugin(PluginTest): ["arches"] ], "opts": {} + }, + # repo without `baseurl` is not allowed + { + "args": [ + "name", + "version", + "distro", + "image_type", + "target", + ["arches"] + ], + "opts": { + "repo": [ + { + "package_sets": ["set1", "set2"] + } + ] + } } ]