distro/rhel86: distro private method isRHEL()

Returns true if the distribution name starts with "rhel".

Signed-off-by: Achilleas Koutsou <achilleas@koutsou.net>
This commit is contained in:
Achilleas Koutsou 2021-10-12 13:51:54 +02:00 committed by Tom Gundersen
parent c7df2f1bc7
commit 93750dd537
2 changed files with 6 additions and 3 deletions

View file

@ -124,6 +124,10 @@ func (d *distribution) addArches(arches ...architecture) {
}
}
func (d *distribution) isRHEL() bool {
return strings.HasPrefix(d.name, "rhel")
}
type architecture struct {
distro *distribution
name string
@ -872,7 +876,7 @@ func newDistro(distroName string) distro.Distro {
ppc64le.addImageTypes(qcow2ImgType, tarImgType)
s390x.addImageTypes(qcow2ImgType, tarImgType)
if strings.HasPrefix(distroName, "rhel") {
if rd.isRHEL() {
// add ec2 image types to RHEL distro only
x86_64.addImageTypes(ec2ImgTypeX86_64, ec2HaImgTypeX86_64, ec2SapImgTypeX86_64)
aarch64.addImageTypes(ec2ImgTypeAarch64)

View file

@ -4,7 +4,6 @@ package rhel86
import (
"fmt"
"strings"
"github.com/osbuild/osbuild-composer/internal/distro"
"github.com/osbuild/osbuild-composer/internal/rpmmd"
@ -505,7 +504,7 @@ func bareMetalPackageSet(t *imageType) rpmmd.PackageSet {
// packages that are only in some (sub)-distributions
func distroSpecificPackageSet(t *imageType) rpmmd.PackageSet {
if strings.HasPrefix(t.Arch().Distro().Name(), "rhel") {
if t.arch.distro.isRHEL() {
return rpmmd.PackageSet{
Include: []string{"insights-client"},
}