From 973a8cf285c87de3e6abd029bfb0c8ce77b49d9f Mon Sep 17 00:00:00 2001 From: Michael Vogt Date: Mon, 8 Jan 2024 10:29:49 +0100 Subject: [PATCH] image-info: update for new "partition" option in mounts.Mount In the osbuild PR#1501 [0] a new paramter "partition" for mounts.Mount() was added. This commit updates the code that it deals cleanly with the new and the old API for `mount.Mount`. [0] https://github.com/osbuild/osbuild/pull/1501 --- tools/image-info | 20 ++++++++++++++------ 1 file changed, 14 insertions(+), 6 deletions(-) diff --git a/tools/image-info b/tools/image-info index 4a3dc1d45..176a5c5cf 100755 --- a/tools/image-info +++ b/tools/image-info @@ -2685,12 +2685,20 @@ def append_partitions(report, image): jsonschema.validate(options, info.get_schema()["properties"]["options"]) # Finally mount - mmgr.mount(mounts.Mount( - part_device, - info, - devices_map[part_device], # retrieves the associated Device Object - part_mountpoint, - options)) + mnt_kwargs = { + "name": part_device, + "info": info, + # retrieves the associated Device Object + "device": devices_map[part_device], + "target": part_mountpoint, + "options": options + } + # XXX: remove inspect and just add "partition" above + # once osbuild PR#1501 is available everywhere + import inspect + if "partition" in inspect.getfullargspec(mounts.Mount).args: + mnt_kwargs["partition"] = None + mmgr.mount(mounts.Mount(**mnt_kwargs)) if not root_tree: raise RuntimeError("The root filesystem tree is not mounted")