Skip to content

Commit

Permalink
distro/fedora: fail on OSTree options for non-OSTree images
Browse files Browse the repository at this point in the history
Modify the `checkOptions()` function to return an `error` in case the
OSTree image options are specified for a non-OSTree based image.
Previously, these would be silently ignored.

Signed-off-by: Tomáš Hozza <[email protected]>
  • Loading branch information
thozza committed Nov 27, 2024
1 parent caaccb3 commit 6c44cd8
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion pkg/distro/fedora/imagetype.go
Original file line number Diff line number Diff line change
Expand Up @@ -288,9 +288,12 @@ func (t *imageType) Manifest(bp *blueprint.Blueprint,
// checkOptions checks the validity and compatibility of options and customizations for the image type.
// Returns ([]string, error) where []string, if non-nil, will hold any generated warnings (e.g. deprecation notices).
func (t *imageType) checkOptions(bp *blueprint.Blueprint, options distro.ImageOptions) ([]string, error) {

customizations := bp.Customizations

if !t.rpmOstree && options.OSTree != nil {
return nil, fmt.Errorf("OSTree is not supported for %q", t.Name())
}

// we do not support embedding containers on ostree-derived images, only on commits themselves
if len(bp.Containers) > 0 && t.rpmOstree && (t.name != "iot-commit" && t.name != "iot-container") {
return nil, fmt.Errorf("embedding containers is not supported for %s on %s", t.name, t.arch.distro.name)
Expand Down

0 comments on commit 6c44cd8

Please sign in to comment.