Tools/osbuild-image-info: rework analyse_iso()

Rework the function to actually fail in case it can't analyze the
provided ISO. Previously, the tool would silently fail to analyze ISO,
generate and generate an empty report. Fix this.

Signed-off-by: Tomáš Hozza <thozza@redhat.com>
This commit is contained in:
Tomáš Hozza 2025-01-16 12:30:21 +01:00 committed by Simon de Vlieger
parent b978559a80
commit c69b16f333

View file

@ -2919,15 +2919,8 @@ def is_iso(path):
def analyse_iso(path):
with tempfile.TemporaryDirectory(dir="/var/tmp") as tmp:
report = None
subprocess.run(["mount", "-o", "loop", path, tmp], check=True)
try:
report = analyse_tarball(os.path.join(tmp, "liveimg.tar.gz"))
except Exception as e:
print(f"{e}", file=sys.stderr)
subprocess.run(["umount", tmp], check=True)
return report
with mount(path, ["loop"]) as tmp:
return analyse_tarball(os.path.join(tmp, "liveimg.tar.gz"))
def main():