Add support for RHSM customizations

Add support for RHSM customizations, which currently allow various
aspects of RHSM. Specifically enabling / disabling DNF plugins shipped
by subscription-manager package and setting a subset of options in the
rhsm.conf.

Signed-off-by: Tomáš Hozza <thozza@redhat.com>
This commit is contained in:
Tomáš Hozza 2024-08-07 17:41:00 +02:00 committed by Tomáš Hozza
parent 26dd54a4d7
commit 768537dba3
14 changed files with 583 additions and 182 deletions

View file

@ -142,6 +142,26 @@ func GetTestBlueprint() blueprint.Blueprint {
},
},
},
RHSM: &blueprint.RHSMCustomization{
Config: &blueprint.RHSMConfig{
DNFPlugins: &blueprint.SubManDNFPluginsConfig{
ProductID: &blueprint.DNFPluginConfig{
Enabled: common.ToPtr(true),
},
SubscriptionManager: &blueprint.DNFPluginConfig{
Enabled: common.ToPtr(false),
},
},
SubscriptionManager: &blueprint.SubManConfig{
RHSMConfig: &blueprint.SubManRHSMConfig{
ManageRepos: common.ToPtr(true),
},
RHSMCertdConfig: &blueprint.SubManRHSMCertdConfig{
AutoRegistration: common.ToPtr(false),
},
},
},
},
}
return expected
@ -273,6 +293,26 @@ func TestGetBlueprintFromCustomizations(t *testing.T) {
},
},
},
Rhsm: &RHSMCustomization{
Config: &RHSMConfig{
DnfPlugins: &SubManDNFPluginsConfig{
ProductId: &DNFPluginConfig{
Enabled: common.ToPtr(true),
},
SubscriptionManager: &DNFPluginConfig{
Enabled: common.ToPtr(false),
},
},
SubscriptionManager: &SubManConfig{
Rhsm: &SubManRHSMConfig{
ManageRepos: common.ToPtr(true),
},
Rhsmcertd: &SubManRHSMCertdConfig{
AutoRegistration: common.ToPtr(false),
},
},
},
},
}}
bp, err = cr.GetBlueprintFromCustomizations()
@ -427,6 +467,26 @@ func TestGetBlueprintFromCompose(t *testing.T) {
},
},
},
Rhsm: &RHSMCustomization{
Config: &RHSMConfig{
DnfPlugins: &SubManDNFPluginsConfig{
ProductId: &DNFPluginConfig{
Enabled: common.ToPtr(true),
},
SubscriptionManager: &DNFPluginConfig{
Enabled: common.ToPtr(false),
},
},
SubscriptionManager: &SubManConfig{
Rhsm: &SubManRHSMConfig{
ManageRepos: common.ToPtr(true),
},
Rhsmcertd: &SubManRHSMCertdConfig{
AutoRegistration: common.ToPtr(false),
},
},
},
},
},
}}