From 3cff4d0c1d33d02422319a766b7780200e239861 Mon Sep 17 00:00:00 2001 From: Achilleas Koutsou Date: Tue, 29 Nov 2022 14:33:06 +0100 Subject: [PATCH] manifest: support RHSM facts in OSCustomizations Add the RHSM fact to the OSCustomizations and add the stage to the OS pipeline if the value is set. --- internal/manifest/os.go | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/internal/manifest/os.go b/internal/manifest/os.go index 35a05df41..1b8998074 100644 --- a/internal/manifest/os.go +++ b/internal/manifest/os.go @@ -95,6 +95,7 @@ type OSCustomizations struct { WAAgentConfig *osbuild.WAAgentConfStageOptions UdevRules *osbuild.UdevRulesStageOptions LeapSecTZ *string + FactAPIType string Subscription *distro.SubscriptionImageOptions RHSMConfig map[distro.RHSMSubscriptionStatus]*osbuild.RHSMStageOptions @@ -521,6 +522,14 @@ func (p *OS) serialize() osbuild.Pipeline { pipeline.AddStage(osbuild.NewOscapRemediationStage(p.OpenSCAPConfig)) } + if p.FactAPIType != "" { + pipeline.AddStage(osbuild.NewRHSMFactsStage(&osbuild.RHSMFactsStageOptions{ + Facts: osbuild.RHSMFacts{ + ApiType: p.FactAPIType, + }, + })) + } + if p.SElinux != "" { pipeline.AddStage(osbuild.NewSELinuxStage(&osbuild.SELinuxStageOptions{ FileContexts: fmt.Sprintf("etc/selinux/%s/contexts/files/file_contexts", p.SElinux),