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 c6ce9fc
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 8 deletions.
16 changes: 12 additions & 4 deletions pkg/manifest/subscription.go
Original file line number Diff line number Diff line change
Expand Up @@ -211,13 +211,21 @@ func runInsightsClientOnBoot() (*fsnode.Directory, *fsnode.File, error) {
return icDropinDirectory, icDropinFile, nil
}

// Filename and contents for the insights-client service drop-in.
// Filename and contents for the insights-client-boot service drop-in.
// This is a temporary workaround until the org.osbuild.systemd.unit stage
// gains support for all the options we need.
//
// The insights-client-boot.service is defined as first boot with a conditional file
// that gets removed when it runs (similar to the registration service).
// We are overriding that here to run at every boot to collect changes after upgrades, etc.
func insightsClientDropin() (string, string) {
return "/etc/systemd/system/insights-client.service.d/override.conf", `[Unit]
return "/etc/systemd/system/insights-client-boot.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
ConditionPathExists=
[Service]
ExecStartPre=
[Install]
WantedBy=multi-user.target`
WantedBy=multi-user.target
`
}
12 changes: 8 additions & 4 deletions pkg/manifest/subscription_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -415,10 +415,14 @@ func mkKeyfile(org, key string) *fsnode.File {
func mkInsightsDropinFile() *fsnode.File {
dropinContents := `[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
ConditionPathExists=
[Service]
ExecStartPre=
[Install]
WantedBy=multi-user.target`
icDropinFile, err := fsnode.NewFile("/etc/systemd/system/insights-client.service.d/override.conf", nil, nil, nil, []byte(dropinContents))
WantedBy=multi-user.target
`
icDropinFile, err := fsnode.NewFile("/etc/systemd/system/insights-client-boot.service.d/override.conf", nil, nil, nil, []byte(dropinContents))
if err != nil {
panic(err)
}
Expand All @@ -427,7 +431,7 @@ WantedBy=multi-user.target`

func mkInsightsDropinDir() *fsnode.Directory {

icDropinDirectory, err := fsnode.NewDirectory("/etc/systemd/system/insights-client.service.d", nil, nil, nil, true)
icDropinDirectory, err := fsnode.NewDirectory("/etc/systemd/system/insights-client-boot.service.d", nil, nil, nil, true)
if err != nil {
panic(err)
}
Expand Down

0 comments on commit c6ce9fc

Please sign in to comment.