cmd/describe: fix describing of OSTree images

OSTree images require additional arguments to serialize their Manifest.
The 'describe' command was not setting those, which resulted in errors
when describing such image types.

Set the required minimum OSTree arguments to dummy values to enable
describing of such images.

Signed-off-by: Tomáš Hozza <thozza@redhat.com>
This commit is contained in:
Tomáš Hozza 2025-06-23 14:32:08 +02:00 committed by Simon de Vlieger
parent 8040fee0d4
commit 44ef682ca1

View file

@ -13,6 +13,7 @@ import (
"github.com/osbuild/images/pkg/distro"
"github.com/osbuild/images/pkg/distro/defs"
"github.com/osbuild/images/pkg/imagefilter"
"github.com/osbuild/images/pkg/ostree"
)
// Use yaml output by default because it is both nicely human and
@ -45,7 +46,16 @@ type packagesYAML struct {
func packageSetsFor(imgType distro.ImageType) (map[string]*packagesYAML, error) {
var bp blueprint.Blueprint
manifest, _, err := imgType.Manifest(&bp, distro.ImageOptions{}, nil, nil)
var imgOpts distro.ImageOptions
// Mock ostree options for ostree-based images to make describe work
if imgType.OSTreeRef() != "" {
imgOpts.OSTree = &ostree.ImageOptions{
URL: "http://example.com/repo",
}
}
manifest, _, err := imgType.Manifest(&bp, imgOpts, nil, nil)
if err != nil {
return nil, err
}