From ce4bc01b7bf2c1c2de37c392a5627ccd4dd85be9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tom=C3=A1=C5=A1=20Hozza?= Date: Tue, 21 Jan 2025 14:35:04 +0100 Subject: [PATCH] osbuild-image-info: exit with non-zero value on empty report MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit For the purpose of using this tool in tests (specifically for manifest tests where we diff image-info reports), it is important that the tools exists with non-zero value if the final report is empty. Signed-off-by: Tomáš Hozza --- tools/osbuild-image-info | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/tools/osbuild-image-info b/tools/osbuild-image-info index 29d4ca02..ada8f645 100755 --- a/tools/osbuild-image-info +++ b/tools/osbuild-image-info @@ -2950,6 +2950,10 @@ def main(): else: report = analyse_image(target) + if not report: + print(f"Failed to analyse {target}: no information gathered in the report", file=sys.stderr) + sys.exit(1) + json.dump(report, sys.stdout, sort_keys=True, indent=2)