diff --git a/stages/org.osbuild.kickstart b/stages/org.osbuild.kickstart index 4b025a72..03d30cf1 100755 --- a/stages/org.osbuild.kickstart +++ b/stages/org.osbuild.kickstart @@ -92,7 +92,11 @@ SCHEMA = r""" } }, "additionalProperties": false, -"required": ["path"], +"anyOf": [ + {"required": ["path", "ostree"], "not": {"required": ["ostreecontainer"]}}, + {"required": ["path", "ostreecontainer"], "not": {"required": ["ostree"]}}, + {"required": ["path"], "not": {"required": ["ostree", "ostreecontainer"]}} +], "properties": { "path": { "type": "string", diff --git a/stages/test/test_kickstart.py b/stages/test/test_kickstart.py index 818d9262..d2ca7340 100644 --- a/stages/test/test_kickstart.py +++ b/stages/test/test_kickstart.py @@ -342,6 +342,23 @@ def test_kickstart_valid(tmp_path, test_input, expected): # pylint: disable=unu # ostreecontainer ({"ostreecontainer": {"url": "http://some-ostree-url.com/foo", "transport": "not-valid"}}, "'not-valid' is not one of ["), + # not both ostreecontainer and ostree + ( + { + "ostreecontainer": { + "url": "http://some-ostree-url.com/foo", + }, + "ostree": { + "osname": "some-osname", + "url": "http://some-ostree-url.com/foo", + "ref": "some-ref", + "remote": "some-remote", + "gpg": True, + }, + }, + "is not valid under any of the given schemas", + ), + ], ) def test_schema_validation_bad_apples(test_data, expected_err):