From 48162bc484d17fb50e3006b2a8e99499ff3258e8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tom=C3=A1=C5=A1=20Hozza?= Date: Wed, 27 Nov 2024 12:46:59 +0100 Subject: [PATCH] distro/rhel: fail on OSTree options for non-OSTree images MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 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 --- pkg/distro/rhel/imagetype.go | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/pkg/distro/rhel/imagetype.go b/pkg/distro/rhel/imagetype.go index 15b63f67c2..36aa6485cd 100644 --- a/pkg/distro/rhel/imagetype.go +++ b/pkg/distro/rhel/imagetype.go @@ -333,6 +333,10 @@ 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) { + if !t.RPMOSTree && options.OSTree != nil { + return nil, fmt.Errorf("OSTree is not supported for %q", t.Name()) + } + if t.arch.distro.CheckOptions != nil { return t.arch.distro.CheckOptions(t, bp, options) }