Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

manifest: override insights-client-boot.service (HMS-4827) #1192

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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