distro/rhel9: adjust RHSM-related config on EC2 9.1+ images

The EC2 images starting with 9.1 should:
 - not configure RHSM using osbuild
 - install `redhat-cloud-client-configuration` package which ships the
   RHSM configuration.

Regenerate affected image manifests.

Related to COMPOSER-1805

Signed-off-by: Tomáš Hozza <thozza@redhat.com>
This commit is contained in:
Tomáš Hozza 2022-10-18 17:45:10 +02:00 committed by Sanne Raymaekers
parent b65bb9491f
commit ae04c56c32
6 changed files with 172 additions and 55 deletions

View file

@ -1048,6 +1048,16 @@ func newDistro(distroName string) distro.Distro {
},
}
// The RHSM configuration should not be applied since 9.1, but it is instead
// done by installing the redhat-cloud-client-configuration package.
// See COMPOSER-1805 for more information.
rhel91PlusEc2ImageConfigOverride := &distro.ImageConfig{
RHSMConfig: map[distro.RHSMSubscriptionStatus]*osbuild.RHSMStageOptions{},
}
if !common.VersionLessThan(rd.osVersion, "9.1") {
defaultEc2ImageConfig = rhel91PlusEc2ImageConfigOverride.InheritFrom(defaultEc2ImageConfig)
}
// default EC2 images config (x86_64)
defaultEc2ImageConfigX86_64 := &distro.ImageConfig{
DracutConf: append(defaultEc2ImageConfig.DracutConf,

View file

@ -5,6 +5,7 @@ package rhel9
import (
"fmt"
"github.com/osbuild/osbuild-composer/internal/common"
"github.com/osbuild/osbuild-composer/internal/distro"
"github.com/osbuild/osbuild-composer/internal/rpmmd"
)
@ -549,6 +550,7 @@ func openstackCommonPackageSet(t *imageType) rpmmd.PackageSet {
return ps
}
// common package set for RHEL (BYOS/RHUI) and CentOS Stream images
func ec2CommonPackageSet(t *imageType) rpmmd.PackageSet {
return rpmmd.PackageSet{
Include: []string{
@ -585,9 +587,19 @@ func ec2CommonPackageSet(t *imageType) rpmmd.PackageSet {
}.Append(bootPackageSet(t)).Append(coreOsCommonPackageSet(t)).Append(distroSpecificPackageSet(t))
}
// common rhel ec2 RHUI image package set
func rhelEc2CommonPackageSet(t *imageType) rpmmd.PackageSet {
ps := ec2CommonPackageSet(t)
// Include "redhat-cloud-client-configuration" on 9.1+ (COMPOSER-1805)
if !common.VersionLessThan(t.arch.distro.osVersion, "9.1") {
ps.Include = append(ps.Include, "redhat-cloud-client-configuration")
}
return ps
}
// rhel-ec2 image package set
func rhelEc2PackageSet(t *imageType) rpmmd.PackageSet {
ec2PackageSet := ec2CommonPackageSet(t)
ec2PackageSet := rhelEc2CommonPackageSet(t)
ec2PackageSet = ec2PackageSet.Append(rpmmd.PackageSet{
Include: []string{
"rh-amazon-rhui-client",
@ -601,7 +613,7 @@ func rhelEc2PackageSet(t *imageType) rpmmd.PackageSet {
// rhel-ha-ec2 image package set
func rhelEc2HaPackageSet(t *imageType) rpmmd.PackageSet {
ec2HaPackageSet := ec2CommonPackageSet(t)
ec2HaPackageSet := rhelEc2CommonPackageSet(t)
ec2HaPackageSet = ec2HaPackageSet.Append(rpmmd.PackageSet{
Include: []string{
"fence-agents-all",
@ -618,7 +630,7 @@ func rhelEc2HaPackageSet(t *imageType) rpmmd.PackageSet {
// rhel-sap-ec2 image package set
func rhelEc2SapPackageSet(t *imageType) rpmmd.PackageSet {
ec2SapPackageSet := ec2CommonPackageSet(t)
ec2SapPackageSet := rhelEc2CommonPackageSet(t)
ec2SapPackageSet = ec2SapPackageSet.Append(rpmmd.PackageSet{
Include: []string{
// RHBZ#2076763