From 10029167db74bd86395ce7066f062134c1542900 Mon Sep 17 00:00:00 2001 From: Achilleas Koutsou Date: Mon, 6 Jan 2025 21:05:37 +0100 Subject: [PATCH] tools/osbuild-image-info: fail early if fstab isn't found When the fstab file isn't found, the root_tree will never be set after being initialised to "" and an exception is raised "The root filesystem tree is not mounted". It's a lot clearer if the failure happens closer to the root cause, which is that fstab wasn't found and there are no fstab entries to iterate through and find the root filesystem. --- tools/osbuild-image-info | 3 +++ 1 file changed, 3 insertions(+) diff --git a/tools/osbuild-image-info b/tools/osbuild-image-info index c7bafea6..a4cef88b 100755 --- a/tools/osbuild-image-info +++ b/tools/osbuild-image-info @@ -2630,6 +2630,9 @@ def append_partitions(report, image): if os.path.exists(f"{tree}/etc/fstab"): fstab.extend(read_fstab(tree)) break + else: + raise RuntimeError("no fstab file found") + # sort the fstab entries by the mountpoint fstab = sorted(fstab, key=operator.itemgetter(1))