tools/osbuild-image-info: skip swap partitions
When iterating partitions to mount, skip any with filesystem type "swap". This is done in two places: 1. When mounting partitions to find /etc/fstab. 2. When mounting partitions and volumes to analyse the tree.
This commit is contained in:
parent
b9e84587ad
commit
dc047513b7
1 changed files with 5 additions and 0 deletions
|
|
@ -2623,6 +2623,8 @@ def append_partitions(report, image):
|
||||||
# find partition with fstab and read it
|
# find partition with fstab and read it
|
||||||
fstab = []
|
fstab = []
|
||||||
for fs in filesystems.values():
|
for fs in filesystems.values():
|
||||||
|
if fs["type"] == "swap":
|
||||||
|
continue
|
||||||
dev, opts = fs["device"], fs.get("mntops")
|
dev, opts = fs["device"], fs.get("mntops")
|
||||||
with mount(dev, opts) as tree:
|
with mount(dev, opts) as tree:
|
||||||
if os.path.exists(f"{tree}/etc/fstab"):
|
if os.path.exists(f"{tree}/etc/fstab"):
|
||||||
|
|
@ -2650,6 +2652,9 @@ def append_partitions(report, image):
|
||||||
info = index.get_module_info("Mount", "org.osbuild.btrfs")
|
info = index.get_module_info("Mount", "org.osbuild.btrfs")
|
||||||
elif "xfs" in part_fstype:
|
elif "xfs" in part_fstype:
|
||||||
info = index.get_module_info("Mount", "org.osbuild.xfs")
|
info = index.get_module_info("Mount", "org.osbuild.xfs")
|
||||||
|
elif "swap" in part_fstype:
|
||||||
|
# can't mount swap partitions
|
||||||
|
continue
|
||||||
else:
|
else:
|
||||||
raise RuntimeError(f"Unknown file system: {part_fstype}")
|
raise RuntimeError(f"Unknown file system: {part_fstype}")
|
||||||
if not info:
|
if not info:
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue