distro/rhel9: conditionally add RHSM to config
Only add the RHSM options to RHEL and not CS9.
This commit is contained in:
parent
85a2029b4a
commit
12cbce58cb
3 changed files with 35 additions and 17 deletions
|
|
@ -237,6 +237,7 @@ func newDistro(name string, major, minor int) distro.Distro {
|
|||
bootType: distro.LegacyBootType,
|
||||
}
|
||||
|
||||
qcow2ImgType := mkQcow2ImgType(rd)
|
||||
ociImgType := qcow2ImgType
|
||||
ociImgType.name = "oci"
|
||||
|
||||
|
|
|
|||
|
|
@ -16,7 +16,9 @@ import (
|
|||
func osCustomizations(
|
||||
t *imageType,
|
||||
osPackageSet rpmmd.PackageSet,
|
||||
c *blueprint.Customizations) manifest.OSCustomizations {
|
||||
options distro.ImageOptions,
|
||||
c *blueprint.Customizations,
|
||||
) manifest.OSCustomizations {
|
||||
|
||||
imageConfig := t.getDefaultImageConfig()
|
||||
|
||||
|
|
@ -122,6 +124,8 @@ func osCustomizations(
|
|||
osc.SshdConfig = imageConfig.SshdConfig
|
||||
osc.AuthConfig = imageConfig.Authconfig
|
||||
osc.PwQuality = imageConfig.PwQuality
|
||||
osc.RHSMConfig = imageConfig.RHSMConfig
|
||||
osc.Subscription = options.Subscription
|
||||
|
||||
return osc
|
||||
}
|
||||
|
|
@ -135,7 +139,7 @@ func liveImage(workload workload.Workload,
|
|||
|
||||
img := image.NewLiveImage()
|
||||
img.Platform = t.platform
|
||||
img.OSCustomizations = osCustomizations(t, packageSets[osPkgsKey], customizations)
|
||||
img.OSCustomizations = osCustomizations(t, packageSets[osPkgsKey], options, customizations)
|
||||
img.Environment = t.environment
|
||||
img.Workload = workload
|
||||
// TODO: move generation into LiveImage
|
||||
|
|
|
|||
|
|
@ -16,21 +16,6 @@ var (
|
|||
packageSets: map[string]packageSetFunc{
|
||||
osPkgsKey: qcow2CommonPackageSet,
|
||||
},
|
||||
defaultImageConfig: &distro.ImageConfig{
|
||||
DefaultTarget: common.StringToPtr("multi-user.target"),
|
||||
RHSMConfig: map[distro.RHSMSubscriptionStatus]*osbuild.RHSMStageOptions{
|
||||
distro.RHSMConfigNoSubscription: {
|
||||
DnfPlugins: &osbuild.RHSMStageOptionsDnfPlugins{
|
||||
ProductID: &osbuild.RHSMStageOptionsDnfPlugin{
|
||||
Enabled: false,
|
||||
},
|
||||
SubscriptionManager: &osbuild.RHSMStageOptionsDnfPlugin{
|
||||
Enabled: false,
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
bootable: true,
|
||||
defaultSize: 10 * common.GibiByte,
|
||||
image: liveImage,
|
||||
|
|
@ -158,3 +143,31 @@ func openstackCommonPackageSet(t *imageType) rpmmd.PackageSet {
|
|||
|
||||
return ps
|
||||
}
|
||||
|
||||
func qcowImageConfig(d distribution) *distro.ImageConfig {
|
||||
ic := &distro.ImageConfig{
|
||||
DefaultTarget: common.StringToPtr("multi-user.target"),
|
||||
}
|
||||
if d.isRHEL() {
|
||||
ic.RHSMConfig = map[distro.RHSMSubscriptionStatus]*osbuild.RHSMStageOptions{
|
||||
distro.RHSMConfigNoSubscription: {
|
||||
DnfPlugins: &osbuild.RHSMStageOptionsDnfPlugins{
|
||||
ProductID: &osbuild.RHSMStageOptionsDnfPlugin{
|
||||
Enabled: false,
|
||||
},
|
||||
SubscriptionManager: &osbuild.RHSMStageOptionsDnfPlugin{
|
||||
Enabled: false,
|
||||
},
|
||||
},
|
||||
},
|
||||
}
|
||||
|
||||
}
|
||||
return ic
|
||||
}
|
||||
|
||||
func mkQcow2ImgType(d distribution) imageType {
|
||||
it := qcow2ImgType
|
||||
it.defaultImageConfig = qcowImageConfig(d)
|
||||
return it
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue