From 6997cff9c05b4a6a4e2ca728643897db251cfd3b Mon Sep 17 00:00:00 2001 From: Simon de Vlieger Date: Wed, 11 May 2022 13:24:37 +0200 Subject: [PATCH] meta: show stage name when schema is missing MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Show the stage name (if one is set) when failing the stage in the validator. This closes #1007, example output: ``` € python3 -m osbuild supakeen-os.json supakeen-os.json has errors: pipelines[0].stages[0] could not find schema information for 'org.osbuild.rpmb' .pipelines[0].stages[0].inputs.packages: could not find schema information for 'org.osbuild.filesz' ``` --- osbuild/meta.py | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/osbuild/meta.py b/osbuild/meta.py index 039d2858..72a21a76 100644 --- a/osbuild/meta.py +++ b/osbuild/meta.py @@ -232,7 +232,13 @@ class Schema: return res if not self.data: - res.fail("missing schema information") + msg = "could not find schema information" + + if self.name: + msg += f" for '{self.name}'" + + res.fail(msg) + return res try: