osbuild-image-info: exit with non-zero value on empty report

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 <thozza@redhat.com>
This commit is contained in:
Tomáš Hozza 2025-01-21 14:35:04 +01:00 committed by Tomáš Hozza
parent 542cf4a799
commit ce4bc01b7b

View file

@ -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)