Skip to content

Commit

Permalink
manifest: add insights-client.service enable
Browse files Browse the repository at this point in the history
Signed-off-by: Jonathan Holloway <[email protected]>
  • Loading branch information
loadtheaccumulator committed Feb 7, 2025
1 parent e569940 commit 744e39b
Show file tree
Hide file tree
Showing 3 changed files with 25 additions and 2 deletions.
16 changes: 15 additions & 1 deletion pkg/manifest/anaconda_installer_iso_tree.go
Original file line number Diff line number Diff line change
Expand Up @@ -702,7 +702,9 @@ func (p *AnacondaInstallerISOTree) makeKickstartStages(stageOptions *osbuild.Kic

}
hardcodedKickstartBits += makeKickstartSubscriptionPost(subscriptionPath, systemPath)

if p.SubscriptionPipeline.Subscription != nil && p.SubscriptionPipeline.Subscription.Insights {
hardcodedKickstartBits += makeKickstartInsightsClientBootPost()
}
// include a readme file on the ISO in the subscription path to explain what it's for
subscriptionReadme, err := fsnode.NewFile(
filepath.Join(subscriptionPath, "README"),
Expand Down Expand Up @@ -780,3 +782,15 @@ systemctl enable osbuild-subscription-register.service
`
return fmt.Sprintf(kickstartSubscriptionPost, fullSourcePath, dest)
}

func makeKickstartInsightsClientBootPost() string {
// Enabling the insights-client.service is necessary for the insights client to
// collect when a system is rebooted after an upgrade.
// It is facilitated via insights-client.service.d/override.conf
kickstartInsightsClientBootPost := `
%post
[ -e /etc/systemd/system/insights-client.service.d/override.conf ] && systemctl enable insights-client.service
%end
`
return kickstartInsightsClientBootPost
}
9 changes: 9 additions & 0 deletions pkg/manifest/anaconda_installer_iso_tree_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -768,3 +768,12 @@ func TestPayloadRemoveSignatures(t *testing.T) {
assert.Equal(t, tc.expected, skopeoStage.Options.(*osbuild.SkopeoStageOptions).RemoveSignatures)
}
}

func TestMakeKickstartInsightsClientBootPost(t *testing.T) {
exp := `
%post
[ -e /etc/systemd/system/insights-client.service.d/override.conf ] && systemctl enable insights-client.service
%end
`
assert.Equal(t, exp, makeKickstartInsightsClientBootPost())
}
2 changes: 1 addition & 1 deletion pkg/manifest/subscription.go
Original file line number Diff line number Diff line change
Expand Up @@ -217,7 +217,7 @@ func runInsightsClientOnBoot() (*fsnode.Directory, *fsnode.File, error) {
func insightsClientDropin() (string, string) {
return "/etc/systemd/system/insights-client.service.d/override.conf", `[Unit]
Requisite=greenboot-healthcheck.service
After=network-online.target greenboot-healthcheck.service osbuild-first-boot.service
After=network-online.target greenboot-healthcheck.service osbuild-first-boot.service osbuild-subscription-register.service
[Install]
WantedBy=multi-user.target`
}

0 comments on commit 744e39b

Please sign in to comment.