Skip to content

Commit

Permalink
feat: Add kernel version to egg installation logs (#62)
Browse files Browse the repository at this point in the history
  • Loading branch information
QuintenQVD0 authored Jan 18, 2025
1 parent 249846b commit 54f8e25
Showing 1 changed file with 20 additions and 2 deletions.
22 changes: 20 additions & 2 deletions server/install.go
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,11 @@ import (
"emperror.dev/errors"
"github.com/apex/log"
"github.com/docker/docker/api/types/container"
dockerImage "github.com/docker/docker/api/types/image"

"github.com/docker/docker/api/types/mount"
"github.com/docker/docker/client"
dockerImage "github.com/docker/docker/api/types/image" // Alias the correct images package
"github.com/docker/docker/pkg/parsers/kernel"

"github.com/pelican-dev/wings/config"
"github.com/pelican-dev/wings/environment"
Expand Down Expand Up @@ -342,6 +344,12 @@ func (ip *InstallationProcess) AfterExecute(containerId string) error {
return err
}

// Get kernel version using the kernel package
v, err := kernel.GetKernelVersion()
if err != nil {
return err
}

f, err := os.OpenFile(ip.GetLogPath(), os.O_WRONLY|os.O_CREATE|os.O_TRUNC, 0o600)
if err != nil {
return err
Expand All @@ -361,6 +369,7 @@ func (ip *InstallationProcess) AfterExecute(containerId string) error {
Server UUID: {{.Server.ID}}
Container Image: {{.Script.ContainerImage}}
Container Entrypoint: {{.Script.Entrypoint}}
Kernel Version: {{.KernelVersion}}
|
| Environment Variables
Expand All @@ -376,7 +385,16 @@ func (ip *InstallationProcess) AfterExecute(containerId string) error {
return err
}

if err := tmpl.Execute(f, ip); err != nil {
// Create a data structure that includes both the InstallationProcess and the kernel version
data := struct {
*InstallationProcess
KernelVersion string
}{
InstallationProcess: ip,
KernelVersion: v.String(),
}

if err := tmpl.Execute(f, data); err != nil {
return err
}

Expand Down

0 comments on commit 54f8e25

Please sign in to comment.