diff --git a/internal/distro/fedora/imagetype.go b/internal/distro/fedora/imagetype.go index bbd431bcc..5b67e2d89 100644 --- a/internal/distro/fedora/imagetype.go +++ b/internal/distro/fedora/imagetype.go @@ -144,7 +144,7 @@ func (t *imageType) PackageSets(bp blueprint.Blueprint, options distro.ImageOpti } } - _, err := t.checkOptions(bp.Customizations, options, containers) + _, err := t.checkOptions(&bp, options) if err != nil { logrus.Errorf("Initializing the manifest failed for %s (%s/%s): %v", t.Name(), t.arch.distro.Name(), t.arch.Name(), err) return nil @@ -286,7 +286,7 @@ func (t *imageType) Manifest(customizations *blueprint.Customizations, repos = mergedRepos var packageSets map[string]rpmmd.PackageSet - warnings, err := t.checkOptions(bp.Customizations, options, containers) + warnings, err := t.checkOptions(bp, options) if err != nil { return nil, nil, err } @@ -328,10 +328,12 @@ func (t *imageType) Manifest(customizations *blueprint.Customizations, // 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(customizations *blueprint.Customizations, options distro.ImageOptions, containers []container.Spec) ([]string, error) { +func (t *imageType) checkOptions(bp *blueprint.Blueprint, options distro.ImageOptions) ([]string, error) { + + customizations := bp.Customizations // we do not support embedding containers on ostree-derived images, only on commits themselves - if len(containers) > 0 && t.rpmOstree && (t.name != "iot-commit" && t.name != "iot-container") { + 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) } diff --git a/internal/distro/rhel7/imagetype.go b/internal/distro/rhel7/imagetype.go index 7a49e4008..913b34242 100644 --- a/internal/distro/rhel7/imagetype.go +++ b/internal/distro/rhel7/imagetype.go @@ -182,7 +182,7 @@ func (t *imageType) Manifest(customizations *blueprint.Customizations, } repos = mergedRepos - warnings, err := t.checkOptions(bp.Customizations, options, containers) + warnings, err := t.checkOptions(bp, options) if err != nil { return nil, nil, err } @@ -265,7 +265,7 @@ func (t *imageType) PackageSets(bp blueprint.Blueprint, options distro.ImageOpti } } - _, err := t.checkOptions(bp.Customizations, options, containers) + _, err := t.checkOptions(&bp, options) if err != nil { logrus.Errorf("Initializing the manifest failed for %s (%s/%s): %v", t.Name(), t.arch.distro.Name(), t.arch.Name(), err) return nil @@ -343,7 +343,8 @@ func overridePackageNames(packages []string) []string { // 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(customizations *blueprint.Customizations, options distro.ImageOptions, containers []container.Spec) ([]string, error) { +func (t *imageType) checkOptions(bp *blueprint.Blueprint, options distro.ImageOptions) ([]string, error) { + customizations := bp.Customizations // holds warnings (e.g. deprecation notices) var warnings []string if t.workload != nil { @@ -357,7 +358,7 @@ func (t *imageType) checkOptions(customizations *blueprint.Customizations, optio } } - if len(containers) > 0 { + if len(bp.Containers) > 0 { return warnings, fmt.Errorf("embedding containers is not supported for %s on %s", t.name, t.arch.distro.name) } diff --git a/internal/distro/rhel8/imagetype.go b/internal/distro/rhel8/imagetype.go index 32e6afbff..3ca69a311 100644 --- a/internal/distro/rhel8/imagetype.go +++ b/internal/distro/rhel8/imagetype.go @@ -215,7 +215,7 @@ func (t *imageType) Manifest(customizations *blueprint.Customizations, } repos = mergedRepos - warnings, err := t.checkOptions(bp.Customizations, options, containers) + warnings, err := t.checkOptions(bp, options) if err != nil { return nil, nil, err } @@ -316,7 +316,7 @@ func (t *imageType) PackageSets(bp blueprint.Blueprint, options distro.ImageOpti } } - _, err := t.checkOptions(bp.Customizations, options, containers) + _, err := t.checkOptions(&bp, options) if err != nil { logrus.Errorf("Initializing the manifest failed for %s (%s/%s): %v", t.Name(), t.arch.distro.Name(), t.arch.Name(), err) return nil @@ -391,7 +391,8 @@ func overridePackageNames(packages []string) []string { // 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(customizations *blueprint.Customizations, options distro.ImageOptions, containers []container.Spec) ([]string, error) { +func (t *imageType) checkOptions(bp *blueprint.Blueprint, options distro.ImageOptions) ([]string, error) { + customizations := bp.Customizations // holds warnings (e.g. deprecation notices) var warnings []string if t.workload != nil { @@ -405,7 +406,7 @@ func (t *imageType) checkOptions(customizations *blueprint.Customizations, optio } } // we do not support embedding containers on ostree-derived images, only on commits themselves - if len(containers) > 0 && t.rpmOstree && (t.name != "edge-commit" && t.name != "edge-container") { + if len(bp.Containers) > 0 && t.rpmOstree && (t.name != "edge-commit" && t.name != "edge-container") { return warnings, fmt.Errorf("embedding containers is not supported for %s on %s", t.name, t.arch.distro.name) } diff --git a/internal/distro/rhel9/imagetype.go b/internal/distro/rhel9/imagetype.go index dfba6f69f..54f518fee 100644 --- a/internal/distro/rhel9/imagetype.go +++ b/internal/distro/rhel9/imagetype.go @@ -218,7 +218,7 @@ func (t *imageType) Manifest(customizations *blueprint.Customizations, } repos = mergedRepos - warnings, err := t.checkOptions(bp.Customizations, options, containers) + warnings, err := t.checkOptions(bp, options) if err != nil { return nil, nil, err } @@ -316,7 +316,7 @@ func (t *imageType) PackageSets(bp blueprint.Blueprint, options distro.ImageOpti } } - _, err := t.checkOptions(bp.Customizations, options, containers) + _, err := t.checkOptions(&bp, options) if err != nil { logrus.Errorf("Initializing the manifest failed for %s (%s/%s): %v", t.Name(), t.arch.distro.Name(), t.arch.Name(), err) return nil @@ -358,7 +358,10 @@ func (t *imageType) PackageSets(bp blueprint.Blueprint, options distro.ImageOpti // 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(customizations *blueprint.Customizations, options distro.ImageOptions, containers []container.Spec) ([]string, error) { +func (t *imageType) checkOptions(bp *blueprint.Blueprint, options distro.ImageOptions) ([]string, error) { + + customizations := bp.Customizations + // holds warnings (e.g. deprecation notices) var warnings []string if t.workload != nil { @@ -373,7 +376,7 @@ func (t *imageType) checkOptions(customizations *blueprint.Customizations, optio } // we do not support embedding containers on ostree-derived images, only on commits themselves - if len(containers) > 0 && t.rpmOstree && (t.name != "edge-commit" && t.name != "edge-container") { + if len(bp.Containers) > 0 && t.rpmOstree && (t.name != "edge-commit" && t.name != "edge-container") { return warnings, fmt.Errorf("embedding containers is not supported for %s on %s", t.name, t.arch.distro.name) }