Skip to content

Commit

Permalink
image-info: update for new "partition" option in mounts.Mount
Browse files Browse the repository at this point in the history
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] osbuild/osbuild#1501
  • Loading branch information
mvo5 committed Jan 8, 2024
1 parent 0169b7b commit 5140877
Showing 1 changed file with 14 additions and 6 deletions.
20 changes: 14 additions & 6 deletions tools/image-info
Original file line number Diff line number Diff line change
Expand Up @@ -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 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")
Expand Down

0 comments on commit 5140877

Please sign in to comment.