RHEL-90: move RHSM configuration to ImageConfig structure
Move the RHSM configuration settings to `ImageConfig` structure and use when handling subscriptions in `osPipeline`, `ec2BaseTreePipeline` and `ostreeTreePipeline` functions. Regenerate image test cases. While there are changed in the manifests, the actual image configuration didn't change at all and thus the `image-info` report was not changed. Signed-off-by: Tomas Hozza <thozza@redhat.com>
This commit is contained in:
parent
b200fa8fcd
commit
8130c892f0
10 changed files with 278 additions and 165 deletions
|
|
@ -2,6 +2,13 @@ package distro
|
|||
|
||||
import "github.com/osbuild/osbuild-composer/internal/osbuild2"
|
||||
|
||||
type RHSMSubscriptionStatus string
|
||||
|
||||
const (
|
||||
RHSMConfigWithSubscription RHSMSubscriptionStatus = "with-subscription"
|
||||
RHSMConfigNoSubscription RHSMSubscriptionStatus = "no-subscription"
|
||||
)
|
||||
|
||||
// ImageConfig represents a (default) configuration applied to the image
|
||||
type ImageConfig struct {
|
||||
Timezone string
|
||||
|
|
@ -12,6 +19,10 @@ type ImageConfig struct {
|
|||
DisabledServices []string
|
||||
DefaultTarget string
|
||||
Sysconfig []*osbuild2.SysconfigStageOptions
|
||||
|
||||
// for RHSM configuration, we need to potentially distinguish the case
|
||||
// when the user want the image to be subscribed on first boot and when not
|
||||
RHSMConfig map[RHSMSubscriptionStatus]*osbuild2.RHSMStageOptions
|
||||
}
|
||||
|
||||
// InheritFrom inherits unset values from the provided parent configuration and
|
||||
|
|
@ -43,6 +54,9 @@ func (c *ImageConfig) InheritFrom(parentConfig *ImageConfig) *ImageConfig {
|
|||
if finalConfig.Sysconfig == nil {
|
||||
finalConfig.Sysconfig = parentConfig.Sysconfig
|
||||
}
|
||||
if finalConfig.RHSMConfig == nil {
|
||||
finalConfig.RHSMConfig = parentConfig.RHSMConfig
|
||||
}
|
||||
}
|
||||
return &finalConfig
|
||||
}
|
||||
|
|
|
|||
|
|
@ -29,6 +29,31 @@ func TestImageConfigInheritFrom(t *testing.T) {
|
|||
EnabledServices: []string{"sshd"},
|
||||
DisabledServices: []string{"named"},
|
||||
DefaultTarget: "multi-user.target",
|
||||
Sysconfig: []*osbuild2.SysconfigStageOptions{
|
||||
{
|
||||
Kernel: &osbuild2.SysconfigKernelOptions{
|
||||
UpdateDefault: true,
|
||||
DefaultKernel: "kernel",
|
||||
},
|
||||
Network: &osbuild2.SysconfigNetworkOptions{
|
||||
Networking: true,
|
||||
NoZeroConf: true,
|
||||
},
|
||||
NetworkScripts: &osbuild2.NetworkScriptsOptions{
|
||||
IfcfgFiles: map[string]osbuild2.IfcfgFile{
|
||||
"eth0": {
|
||||
Device: "eth0",
|
||||
Bootproto: osbuild2.IfcfgBootprotoDHCP,
|
||||
OnBoot: common.BoolToPtr(true),
|
||||
Type: osbuild2.IfcfgTypeEthernet,
|
||||
UserCtl: common.BoolToPtr(true),
|
||||
PeerDNS: common.BoolToPtr(true),
|
||||
IPv6Init: common.BoolToPtr(false),
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
imageConfig: &ImageConfig{
|
||||
Timezone: "UTC",
|
||||
|
|
@ -66,6 +91,31 @@ func TestImageConfigInheritFrom(t *testing.T) {
|
|||
EnabledServices: []string{"sshd"},
|
||||
DisabledServices: []string{"named"},
|
||||
DefaultTarget: "multi-user.target",
|
||||
Sysconfig: []*osbuild2.SysconfigStageOptions{
|
||||
{
|
||||
Kernel: &osbuild2.SysconfigKernelOptions{
|
||||
UpdateDefault: true,
|
||||
DefaultKernel: "kernel",
|
||||
},
|
||||
Network: &osbuild2.SysconfigNetworkOptions{
|
||||
Networking: true,
|
||||
NoZeroConf: true,
|
||||
},
|
||||
NetworkScripts: &osbuild2.NetworkScriptsOptions{
|
||||
IfcfgFiles: map[string]osbuild2.IfcfgFile{
|
||||
"eth0": {
|
||||
Device: "eth0",
|
||||
Bootproto: osbuild2.IfcfgBootprotoDHCP,
|
||||
OnBoot: common.BoolToPtr(true),
|
||||
Type: osbuild2.IfcfgTypeEthernet,
|
||||
UserCtl: common.BoolToPtr(true),
|
||||
PeerDNS: common.BoolToPtr(true),
|
||||
IPv6Init: common.BoolToPtr(false),
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
{
|
||||
|
|
|
|||
|
|
@ -725,6 +725,18 @@ func newDistro(distroName string) distro.Distro {
|
|||
},
|
||||
defaultImageConfig: &distro.ImageConfig{
|
||||
DefaultTarget: "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 * GigaByte,
|
||||
|
|
@ -856,8 +868,62 @@ func newDistro(distroName string) distro.Distro {
|
|||
},
|
||||
},
|
||||
},
|
||||
RHSMConfig: map[distro.RHSMSubscriptionStatus]*osbuild.RHSMStageOptions{
|
||||
distro.RHSMConfigNoSubscription: {
|
||||
// RHBZ#1932802
|
||||
SubMan: &osbuild.RHSMStageOptionsSubMan{
|
||||
Rhsmcertd: &osbuild.SubManConfigRHSMCERTDSection{
|
||||
AutoRegistration: common.BoolToPtr(true),
|
||||
},
|
||||
Rhsm: &osbuild.SubManConfigRHSMSection{
|
||||
ManageRepos: common.BoolToPtr(false),
|
||||
},
|
||||
},
|
||||
},
|
||||
distro.RHSMConfigWithSubscription: {
|
||||
// RHBZ#1932802
|
||||
SubMan: &osbuild.RHSMStageOptionsSubMan{
|
||||
Rhsmcertd: &osbuild.SubManConfigRHSMCERTDSection{
|
||||
AutoRegistration: common.BoolToPtr(true),
|
||||
},
|
||||
// do not disable the redhat.repo management if the user
|
||||
// explicitly request the system to be subscribed
|
||||
},
|
||||
},
|
||||
},
|
||||
}
|
||||
|
||||
defaultAMIImageConfig := &distro.ImageConfig{
|
||||
RHSMConfig: map[distro.RHSMSubscriptionStatus]*osbuild.RHSMStageOptions{
|
||||
distro.RHSMConfigNoSubscription: {
|
||||
// RHBZ#1932802
|
||||
SubMan: &osbuild.RHSMStageOptionsSubMan{
|
||||
Rhsmcertd: &osbuild.SubManConfigRHSMCERTDSection{
|
||||
AutoRegistration: common.BoolToPtr(true),
|
||||
},
|
||||
// Don't disable RHSM redhat.repo management on the AMI
|
||||
// image, which is BYOS and does not use RHUI for content.
|
||||
// Otherwise subscribing the system manually after booting
|
||||
// it would result in empty redhat.repo. Without RHUI, such
|
||||
// system would have no way to get Red Hat content, but
|
||||
// enable the repo management manually, which would be very
|
||||
// confusing.
|
||||
},
|
||||
},
|
||||
distro.RHSMConfigWithSubscription: {
|
||||
// RHBZ#1932802
|
||||
SubMan: &osbuild.RHSMStageOptionsSubMan{
|
||||
Rhsmcertd: &osbuild.SubManConfigRHSMCERTDSection{
|
||||
AutoRegistration: common.BoolToPtr(true),
|
||||
},
|
||||
// do not disable the redhat.repo management if the user
|
||||
// explicitly request the system to be subscribed
|
||||
},
|
||||
},
|
||||
},
|
||||
}
|
||||
defaultAMIImageConfig = defaultAMIImageConfig.InheritFrom(defaultEc2ImageConfig)
|
||||
|
||||
amiImgTypeX86_64 := imageType{
|
||||
name: "ami",
|
||||
filename: "image.raw",
|
||||
|
|
@ -866,7 +932,7 @@ func newDistro(distroName string) distro.Distro {
|
|||
buildPkgsKey: ec2BuildPackageSet,
|
||||
osPkgsKey: ec2CommonPackageSet,
|
||||
},
|
||||
defaultImageConfig: defaultEc2ImageConfig,
|
||||
defaultImageConfig: defaultAMIImageConfig,
|
||||
kernelOptions: "console=ttyS0,115200n8 console=tty0 net.ifnames=0 rd.blacklist=nouveau nvme_core.io_timeout=4294967295 crashkernel=auto",
|
||||
bootable: true,
|
||||
bootType: distro.LegacyBootType,
|
||||
|
|
@ -886,7 +952,7 @@ func newDistro(distroName string) distro.Distro {
|
|||
buildPkgsKey: ec2BuildPackageSet,
|
||||
osPkgsKey: ec2CommonPackageSet,
|
||||
},
|
||||
defaultImageConfig: defaultEc2ImageConfig,
|
||||
defaultImageConfig: defaultAMIImageConfig,
|
||||
kernelOptions: "console=ttyS0,115200n8 console=tty0 net.ifnames=0 rd.blacklist=nouveau nvme_core.io_timeout=4294967295 iommu.strict=0 crashkernel=auto",
|
||||
bootable: true,
|
||||
defaultSize: 10 * GigaByte,
|
||||
|
|
|
|||
|
|
@ -31,20 +31,6 @@ func qcow2Pipelines(t *imageType, customizations *blueprint.Customizations, opti
|
|||
|
||||
treePipeline = prependKernelCmdlineStage(treePipeline, t, &partitionTable)
|
||||
|
||||
if options.Subscription == nil {
|
||||
// RHSM DNF plugins should be by default disabled on RHEL Guest KVM images
|
||||
treePipeline.AddStage(osbuild.NewRHSMStage(&osbuild.RHSMStageOptions{
|
||||
DnfPlugins: &osbuild.RHSMStageOptionsDnfPlugins{
|
||||
ProductID: &osbuild.RHSMStageOptionsDnfPlugin{
|
||||
Enabled: false,
|
||||
},
|
||||
SubscriptionManager: &osbuild.RHSMStageOptionsDnfPlugin{
|
||||
Enabled: false,
|
||||
},
|
||||
},
|
||||
}))
|
||||
}
|
||||
|
||||
treePipeline.AddStage(osbuild.NewFSTabStage(partitionTable.FSTabStageOptionsV2()))
|
||||
kernelVer := kernelVerStr(packageSetSpecs[blueprintPkgsKey], customizations.GetKernel().Name, t.Arch().Name())
|
||||
treePipeline.AddStage(bootloaderConfigStage(t, partitionTable, customizations.GetKernel(), kernelVer, false, false))
|
||||
|
|
@ -163,8 +149,6 @@ func openstackPipelines(t *imageType, customizations *blueprint.Customizations,
|
|||
// The expectation is that specific EC2 image types can extend the returned pipeline
|
||||
// by appending additional stages.
|
||||
//
|
||||
// The argument `withRHUI` should be set to `true` only if the image package set includes RHUI client packages.
|
||||
//
|
||||
// Note: the caller of this function has to append the `osbuild.NewSELinuxStage(selinuxStageOptions(false))` stage
|
||||
// as the last one to the returned pipeline. The stage is not appended on purpose, to allow caller to append
|
||||
// any additional stages to the pipeline, but before the SELinuxStage, which must be always the last one.
|
||||
|
|
@ -175,7 +159,6 @@ func ec2BaseTreePipeline(
|
|||
bpPackages []rpmmd.PackageSpec,
|
||||
c *blueprint.Customizations,
|
||||
options distro.ImageOptions,
|
||||
withRHUI bool,
|
||||
pt *disk.PartitionTable) (*osbuild.Pipeline, error) {
|
||||
|
||||
// COMMON WITH osPipeline - START
|
||||
|
|
@ -251,6 +234,30 @@ func ec2BaseTreePipeline(
|
|||
for _, sysconfigConfig := range imageConfig.Sysconfig {
|
||||
p.AddStage(osbuild.NewSysconfigStage(sysconfigConfig))
|
||||
}
|
||||
|
||||
if t.arch.distro.isRHEL() {
|
||||
if options.Subscription != nil {
|
||||
commands := []string{
|
||||
fmt.Sprintf("/usr/sbin/subscription-manager register --org=%s --activationkey=%s --serverurl %s --baseurl %s", options.Subscription.Organization, options.Subscription.ActivationKey, options.Subscription.ServerUrl, options.Subscription.BaseUrl),
|
||||
}
|
||||
if options.Subscription.Insights {
|
||||
commands = append(commands, "/usr/bin/insights-client --register")
|
||||
}
|
||||
p.AddStage(osbuild.NewFirstBootStage(&osbuild.FirstBootStageOptions{
|
||||
Commands: commands,
|
||||
WaitForNetwork: true,
|
||||
}))
|
||||
|
||||
if rhsmConfig, exists := imageConfig.RHSMConfig[distro.RHSMConfigWithSubscription]; exists {
|
||||
p.AddStage(osbuild.NewRHSMStage(rhsmConfig))
|
||||
}
|
||||
} else {
|
||||
if rhsmConfig, exists := imageConfig.RHSMConfig[distro.RHSMConfigNoSubscription]; exists {
|
||||
p.AddStage(osbuild.NewRHSMStage(rhsmConfig))
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// COMMON WITH osPipeline - END
|
||||
|
||||
p.AddStage(osbuild.NewSystemdLogindStage(&osbuild.SystemdLogindStageOptions{
|
||||
|
|
@ -303,53 +310,13 @@ func ec2BaseTreePipeline(
|
|||
Profile: "sssd",
|
||||
}))
|
||||
|
||||
if t.arch.distro.isRHEL() {
|
||||
if options.Subscription != nil {
|
||||
commands := []string{
|
||||
fmt.Sprintf("/usr/sbin/subscription-manager register --org=%s --activationkey=%s --serverurl %s --baseurl %s", options.Subscription.Organization, options.Subscription.ActivationKey, options.Subscription.ServerUrl, options.Subscription.BaseUrl),
|
||||
}
|
||||
if options.Subscription.Insights {
|
||||
commands = append(commands, "/usr/bin/insights-client --register")
|
||||
}
|
||||
|
||||
p.AddStage(osbuild.NewFirstBootStage(&osbuild.FirstBootStageOptions{
|
||||
Commands: commands,
|
||||
WaitForNetwork: true,
|
||||
}))
|
||||
} else {
|
||||
// The EC2 images should keep the RHSM DNF plugins enabled (RHBZ#1996670)
|
||||
rhsmStageOptions := &osbuild.RHSMStageOptions{
|
||||
// RHBZ#1932802
|
||||
SubMan: &osbuild.RHSMStageOptionsSubMan{
|
||||
Rhsmcertd: &osbuild.SubManConfigRHSMCERTDSection{
|
||||
AutoRegistration: common.BoolToPtr(true),
|
||||
},
|
||||
},
|
||||
}
|
||||
|
||||
// Disable RHSM redhat.repo management only if the image uses RHUI
|
||||
// for content. Otherwise subscribing the system manually after booting
|
||||
// it would result in empty redhat.repo. Without RHUI, such system
|
||||
// would have no way to get Red Hat content, but enable the repo
|
||||
// management manually, which would be very confusing.
|
||||
// RHBZ#1932802
|
||||
if withRHUI {
|
||||
rhsmStageOptions.SubMan.Rhsm = &osbuild.SubManConfigRHSMSection{
|
||||
ManageRepos: common.BoolToPtr(false),
|
||||
}
|
||||
}
|
||||
|
||||
p.AddStage(osbuild.NewRHSMStage(rhsmStageOptions))
|
||||
}
|
||||
}
|
||||
|
||||
return p, nil
|
||||
}
|
||||
|
||||
func ec2X86_64BaseTreePipeline(t *imageType, repos []rpmmd.RepoConfig, packages []rpmmd.PackageSpec, bpPackages []rpmmd.PackageSpec,
|
||||
c *blueprint.Customizations, options distro.ImageOptions, withRHUI bool, pt *disk.PartitionTable) (*osbuild.Pipeline, error) {
|
||||
c *blueprint.Customizations, options distro.ImageOptions, pt *disk.PartitionTable) (*osbuild.Pipeline, error) {
|
||||
|
||||
treePipeline, err := ec2BaseTreePipeline(t, repos, packages, bpPackages, c, options, withRHUI, pt)
|
||||
treePipeline, err := ec2BaseTreePipeline(t, repos, packages, bpPackages, c, options, pt)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
|
@ -372,7 +339,7 @@ func ec2X86_64BaseTreePipeline(t *imageType, repos []rpmmd.RepoConfig, packages
|
|||
|
||||
func ec2CommonPipelines(t *imageType, customizations *blueprint.Customizations, options distro.ImageOptions,
|
||||
repos []rpmmd.RepoConfig, packageSetSpecs map[string][]rpmmd.PackageSpec,
|
||||
rng *rand.Rand, withRHUI bool, diskfile string) ([]osbuild.Pipeline, error) {
|
||||
rng *rand.Rand, diskfile string) ([]osbuild.Pipeline, error) {
|
||||
pipelines := make([]osbuild.Pipeline, 0)
|
||||
pipelines = append(pipelines, *buildPipeline(repos, packageSetSpecs[buildPkgsKey], t.arch.distro.runner))
|
||||
|
||||
|
|
@ -385,10 +352,10 @@ func ec2CommonPipelines(t *imageType, customizations *blueprint.Customizations,
|
|||
switch arch := t.arch.Name(); arch {
|
||||
// rhel-ec2-x86_64, rhel-ha-ec2
|
||||
case distro.X86_64ArchName:
|
||||
treePipeline, err = ec2X86_64BaseTreePipeline(t, repos, packageSetSpecs[osPkgsKey], packageSetSpecs[blueprintPkgsKey], customizations, options, withRHUI, &partitionTable)
|
||||
treePipeline, err = ec2X86_64BaseTreePipeline(t, repos, packageSetSpecs[osPkgsKey], packageSetSpecs[blueprintPkgsKey], customizations, options, &partitionTable)
|
||||
// rhel-ec2-aarch64
|
||||
case distro.Aarch64ArchName:
|
||||
treePipeline, err = ec2BaseTreePipeline(t, repos, packageSetSpecs[osPkgsKey], packageSetSpecs[blueprintPkgsKey], customizations, options, withRHUI, &partitionTable)
|
||||
treePipeline, err = ec2BaseTreePipeline(t, repos, packageSetSpecs[osPkgsKey], packageSetSpecs[blueprintPkgsKey], customizations, options, &partitionTable)
|
||||
default:
|
||||
return nil, fmt.Errorf("ec2CommonPipelines: unsupported image architecture: %q", arch)
|
||||
}
|
||||
|
|
@ -411,7 +378,7 @@ func ec2CommonPipelines(t *imageType, customizations *blueprint.Customizations,
|
|||
|
||||
func ec2SapPipelines(t *imageType, customizations *blueprint.Customizations, options distro.ImageOptions,
|
||||
repos []rpmmd.RepoConfig, packageSetSpecs map[string][]rpmmd.PackageSpec,
|
||||
rng *rand.Rand, withRHUI bool, diskfile string) ([]osbuild.Pipeline, error) {
|
||||
rng *rand.Rand, diskfile string) ([]osbuild.Pipeline, error) {
|
||||
pipelines := make([]osbuild.Pipeline, 0)
|
||||
pipelines = append(pipelines, *buildPipeline(repos, packageSetSpecs[buildPkgsKey], t.arch.distro.runner))
|
||||
|
||||
|
|
@ -424,7 +391,7 @@ func ec2SapPipelines(t *imageType, customizations *blueprint.Customizations, opt
|
|||
switch arch := t.arch.Name(); arch {
|
||||
// rhel-sap-ec2
|
||||
case distro.X86_64ArchName:
|
||||
treePipeline, err = ec2X86_64BaseTreePipeline(t, repos, packageSetSpecs[osPkgsKey], packageSetSpecs[blueprintPkgsKey], customizations, options, withRHUI, &partitionTable)
|
||||
treePipeline, err = ec2X86_64BaseTreePipeline(t, repos, packageSetSpecs[osPkgsKey], packageSetSpecs[blueprintPkgsKey], customizations, options, &partitionTable)
|
||||
default:
|
||||
return nil, fmt.Errorf("ec2SapPipelines: unsupported image architecture: %q", arch)
|
||||
}
|
||||
|
|
@ -552,14 +519,14 @@ func ec2SapPipelines(t *imageType, customizations *blueprint.Customizations, opt
|
|||
|
||||
// ec2Pipelines returns pipelines which produce uncompressed EC2 images which are expected to use RHSM for content
|
||||
func ec2Pipelines(t *imageType, customizations *blueprint.Customizations, options distro.ImageOptions, repos []rpmmd.RepoConfig, packageSetSpecs map[string][]rpmmd.PackageSpec, rng *rand.Rand) ([]osbuild.Pipeline, error) {
|
||||
return ec2CommonPipelines(t, customizations, options, repos, packageSetSpecs, rng, false, t.Filename())
|
||||
return ec2CommonPipelines(t, customizations, options, repos, packageSetSpecs, rng, t.Filename())
|
||||
}
|
||||
|
||||
// rhelEc2Pipelines returns pipelines which produce XZ-compressed EC2 images which are expected to use RHUI for content
|
||||
func rhelEc2Pipelines(t *imageType, customizations *blueprint.Customizations, options distro.ImageOptions, repos []rpmmd.RepoConfig, packageSetSpecs map[string][]rpmmd.PackageSpec, rng *rand.Rand) ([]osbuild.Pipeline, error) {
|
||||
rawImageFilename := "image.raw"
|
||||
|
||||
pipelines, err := ec2CommonPipelines(t, customizations, options, repos, packageSetSpecs, rng, true, rawImageFilename)
|
||||
pipelines, err := ec2CommonPipelines(t, customizations, options, repos, packageSetSpecs, rng, rawImageFilename)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
|
@ -574,7 +541,7 @@ func rhelEc2Pipelines(t *imageType, customizations *blueprint.Customizations, op
|
|||
func rhelEc2SapPipelines(t *imageType, customizations *blueprint.Customizations, options distro.ImageOptions, repos []rpmmd.RepoConfig, packageSetSpecs map[string][]rpmmd.PackageSpec, rng *rand.Rand) ([]osbuild.Pipeline, error) {
|
||||
rawImageFilename := "image.raw"
|
||||
|
||||
pipelines, err := ec2SapPipelines(t, customizations, options, repos, packageSetSpecs, rng, true, rawImageFilename)
|
||||
pipelines, err := ec2SapPipelines(t, customizations, options, repos, packageSetSpecs, rng, rawImageFilename)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
|
@ -839,19 +806,27 @@ func osPipeline(t *imageType,
|
|||
p.AddStage(osbuild.NewSysconfigStage(sysconfigConfig))
|
||||
}
|
||||
|
||||
if options.Subscription != nil {
|
||||
commands := []string{
|
||||
fmt.Sprintf("/usr/sbin/subscription-manager register --org=%s --activationkey=%s --serverurl %s --baseurl %s", options.Subscription.Organization, options.Subscription.ActivationKey, options.Subscription.ServerUrl, options.Subscription.BaseUrl),
|
||||
}
|
||||
if options.Subscription.Insights {
|
||||
commands = append(commands, "/usr/bin/insights-client --register")
|
||||
}
|
||||
if t.arch.distro.isRHEL() {
|
||||
if options.Subscription != nil {
|
||||
commands := []string{
|
||||
fmt.Sprintf("/usr/sbin/subscription-manager register --org=%s --activationkey=%s --serverurl %s --baseurl %s", options.Subscription.Organization, options.Subscription.ActivationKey, options.Subscription.ServerUrl, options.Subscription.BaseUrl),
|
||||
}
|
||||
if options.Subscription.Insights {
|
||||
commands = append(commands, "/usr/bin/insights-client --register")
|
||||
}
|
||||
p.AddStage(osbuild.NewFirstBootStage(&osbuild.FirstBootStageOptions{
|
||||
Commands: commands,
|
||||
WaitForNetwork: true,
|
||||
}))
|
||||
|
||||
p.AddStage(osbuild.NewFirstBootStage(&osbuild.FirstBootStageOptions{
|
||||
Commands: commands,
|
||||
WaitForNetwork: true,
|
||||
},
|
||||
))
|
||||
if rhsmConfig, exists := imageConfig.RHSMConfig[distro.RHSMConfigWithSubscription]; exists {
|
||||
p.AddStage(osbuild.NewRHSMStage(rhsmConfig))
|
||||
}
|
||||
} else {
|
||||
if rhsmConfig, exists := imageConfig.RHSMConfig[distro.RHSMConfigNoSubscription]; exists {
|
||||
p.AddStage(osbuild.NewRHSMStage(rhsmConfig))
|
||||
}
|
||||
}
|
||||
}
|
||||
return p, nil
|
||||
}
|
||||
|
|
@ -931,19 +906,27 @@ func ostreeTreePipeline(t *imageType, repos []rpmmd.RepoConfig, packages []rpmmd
|
|||
p.AddStage(osbuild.NewSysconfigStage(sysconfigConfig))
|
||||
}
|
||||
|
||||
if options.Subscription != nil {
|
||||
commands := []string{
|
||||
fmt.Sprintf("/usr/sbin/subscription-manager register --org=%s --activationkey=%s --serverurl %s --baseurl %s", options.Subscription.Organization, options.Subscription.ActivationKey, options.Subscription.ServerUrl, options.Subscription.BaseUrl),
|
||||
}
|
||||
if options.Subscription.Insights {
|
||||
commands = append(commands, "/usr/bin/insights-client --register")
|
||||
}
|
||||
if t.arch.distro.isRHEL() {
|
||||
if options.Subscription != nil {
|
||||
commands := []string{
|
||||
fmt.Sprintf("/usr/sbin/subscription-manager register --org=%s --activationkey=%s --serverurl %s --baseurl %s", options.Subscription.Organization, options.Subscription.ActivationKey, options.Subscription.ServerUrl, options.Subscription.BaseUrl),
|
||||
}
|
||||
if options.Subscription.Insights {
|
||||
commands = append(commands, "/usr/bin/insights-client --register")
|
||||
}
|
||||
p.AddStage(osbuild.NewFirstBootStage(&osbuild.FirstBootStageOptions{
|
||||
Commands: commands,
|
||||
WaitForNetwork: true,
|
||||
}))
|
||||
|
||||
p.AddStage(osbuild.NewFirstBootStage(&osbuild.FirstBootStageOptions{
|
||||
Commands: commands,
|
||||
WaitForNetwork: true,
|
||||
},
|
||||
))
|
||||
if rhsmConfig, exists := imageConfig.RHSMConfig[distro.RHSMConfigWithSubscription]; exists {
|
||||
p.AddStage(osbuild.NewRHSMStage(rhsmConfig))
|
||||
}
|
||||
} else {
|
||||
if rhsmConfig, exists := imageConfig.RHSMConfig[distro.RHSMConfigNoSubscription]; exists {
|
||||
p.AddStage(osbuild.NewRHSMStage(rhsmConfig))
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
p.AddStage(osbuild.NewSELinuxStage(selinuxStageOptions(false)))
|
||||
|
|
|
|||
|
|
@ -902,6 +902,16 @@
|
|||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
"type": "org.osbuild.rhsm",
|
||||
"options": {
|
||||
"subscription-manager": {
|
||||
"rhsmcertd": {
|
||||
"auto_registration": true
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
"type": "org.osbuild.systemd-logind",
|
||||
"options": {
|
||||
|
|
@ -967,16 +977,6 @@
|
|||
"profile": "sssd"
|
||||
}
|
||||
},
|
||||
{
|
||||
"type": "org.osbuild.rhsm",
|
||||
"options": {
|
||||
"subscription-manager": {
|
||||
"rhsmcertd": {
|
||||
"auto_registration": true
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
"type": "org.osbuild.fstab",
|
||||
"options": {
|
||||
|
|
|
|||
|
|
@ -913,6 +913,19 @@
|
|||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
"type": "org.osbuild.rhsm",
|
||||
"options": {
|
||||
"subscription-manager": {
|
||||
"rhsm": {
|
||||
"manage_repos": false
|
||||
},
|
||||
"rhsmcertd": {
|
||||
"auto_registration": true
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
"type": "org.osbuild.systemd-logind",
|
||||
"options": {
|
||||
|
|
@ -978,19 +991,6 @@
|
|||
"profile": "sssd"
|
||||
}
|
||||
},
|
||||
{
|
||||
"type": "org.osbuild.rhsm",
|
||||
"options": {
|
||||
"subscription-manager": {
|
||||
"rhsm": {
|
||||
"manage_repos": false
|
||||
},
|
||||
"rhsmcertd": {
|
||||
"auto_registration": true
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
"type": "org.osbuild.fstab",
|
||||
"options": {
|
||||
|
|
|
|||
|
|
@ -885,6 +885,16 @@
|
|||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
"type": "org.osbuild.rhsm",
|
||||
"options": {
|
||||
"subscription-manager": {
|
||||
"rhsmcertd": {
|
||||
"auto_registration": true
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
"type": "org.osbuild.systemd-logind",
|
||||
"options": {
|
||||
|
|
@ -950,16 +960,6 @@
|
|||
"profile": "sssd"
|
||||
}
|
||||
},
|
||||
{
|
||||
"type": "org.osbuild.rhsm",
|
||||
"options": {
|
||||
"subscription-manager": {
|
||||
"rhsmcertd": {
|
||||
"auto_registration": true
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
"type": "org.osbuild.dracut.conf",
|
||||
"options": {
|
||||
|
|
|
|||
|
|
@ -898,6 +898,19 @@
|
|||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
"type": "org.osbuild.rhsm",
|
||||
"options": {
|
||||
"subscription-manager": {
|
||||
"rhsm": {
|
||||
"manage_repos": false
|
||||
},
|
||||
"rhsmcertd": {
|
||||
"auto_registration": true
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
"type": "org.osbuild.systemd-logind",
|
||||
"options": {
|
||||
|
|
@ -963,19 +976,6 @@
|
|||
"profile": "sssd"
|
||||
}
|
||||
},
|
||||
{
|
||||
"type": "org.osbuild.rhsm",
|
||||
"options": {
|
||||
"subscription-manager": {
|
||||
"rhsm": {
|
||||
"manage_repos": false
|
||||
},
|
||||
"rhsmcertd": {
|
||||
"auto_registration": true
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
"type": "org.osbuild.dracut.conf",
|
||||
"options": {
|
||||
|
|
|
|||
|
|
@ -1092,6 +1092,19 @@
|
|||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
"type": "org.osbuild.rhsm",
|
||||
"options": {
|
||||
"subscription-manager": {
|
||||
"rhsm": {
|
||||
"manage_repos": false
|
||||
},
|
||||
"rhsmcertd": {
|
||||
"auto_registration": true
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
"type": "org.osbuild.systemd-logind",
|
||||
"options": {
|
||||
|
|
@ -1157,19 +1170,6 @@
|
|||
"profile": "sssd"
|
||||
}
|
||||
},
|
||||
{
|
||||
"type": "org.osbuild.rhsm",
|
||||
"options": {
|
||||
"subscription-manager": {
|
||||
"rhsm": {
|
||||
"manage_repos": false
|
||||
},
|
||||
"rhsmcertd": {
|
||||
"auto_registration": true
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
"type": "org.osbuild.dracut.conf",
|
||||
"options": {
|
||||
|
|
|
|||
|
|
@ -1146,6 +1146,19 @@
|
|||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
"type": "org.osbuild.rhsm",
|
||||
"options": {
|
||||
"subscription-manager": {
|
||||
"rhsm": {
|
||||
"manage_repos": false
|
||||
},
|
||||
"rhsmcertd": {
|
||||
"auto_registration": true
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
"type": "org.osbuild.systemd-logind",
|
||||
"options": {
|
||||
|
|
@ -1211,19 +1224,6 @@
|
|||
"profile": "sssd"
|
||||
}
|
||||
},
|
||||
{
|
||||
"type": "org.osbuild.rhsm",
|
||||
"options": {
|
||||
"subscription-manager": {
|
||||
"rhsm": {
|
||||
"manage_repos": false
|
||||
},
|
||||
"rhsmcertd": {
|
||||
"auto_registration": true
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
"type": "org.osbuild.dracut.conf",
|
||||
"options": {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue