From a8fcda834859a43a4bc350be55afb30d96c0ded0 Mon Sep 17 00:00:00 2001 From: Christian Kellner Date: Mon, 31 May 2021 16:56:24 +0000 Subject: [PATCH] meta: support definitions in schema version 2 For schema version 2 of modules, the `definitions` node, as defined in the module itself, won't be at the `options` level but at the level of the `properties` node. Look for a `definitions` at that `properties` level and move it to the top, if found. --- osbuild/meta.py | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/osbuild/meta.py b/osbuild/meta.py index 322f515a..61af8cd1 100644 --- a/osbuild/meta.py +++ b/osbuild/meta.py @@ -338,7 +338,12 @@ class ModuleInfo: # the top level schema node, since the schema inside the # stages is written as-if they were the root node and # so are the references - options = schema.get("properties", {}).get("options", {}) + props = schema.get("properties", {}) + if "definitions" in props: + schema["definitions"] = props["definitions"] + del props["definitions"] + + options = props.get("options", {}) if "definitions" in options: schema["definitions"] = options["definitions"] del options["definitions"]