Skip to content

Commit

Permalink
Remove imgid field in coreos aleph
Browse files Browse the repository at this point in the history
This commit removes the dependency of the imgid field in the coreos
aleph file. As per the discussion in the following PR to OSBuild,
as decision was made to remove the field:

dustymabe/osbuild#10 (comment)

A decision was also made to log the entire aleph file since it is more
verbose.
  • Loading branch information
lukewarmtemp committed Dec 1, 2023
1 parent d469add commit fd01871
Showing 1 changed file with 11 additions and 8 deletions.
19 changes: 11 additions & 8 deletions pkg/daemon/coreos.go
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package daemon
package main

// This file provides routines that apply on Fedora CoreOS style systems,
// including deriviatives like RHEL CoreOS.
Expand All @@ -16,11 +16,6 @@ import (
// information see e.g. https://github.com/coreos/fedora-coreos-tracker/blob/main/internals%2FREADME-internals.md#aleph-version
const alephPath = "/sysroot/.coreos-aleph-version.json"

type coreosAleph struct {
Build string `json:"build"`
Imgid string `json:"imgid"`
}

// ignitionProvisioningPath is written by Ignition, see
// https://github.com/coreos/ignition/commit/556bc9404cfff08ea63c2a865bd3586ece7e8e44
const ignitionProvisioningPath = "/etc/.ignition-result.json"
Expand All @@ -47,11 +42,15 @@ func logAlephInformation() error {
if err != nil {
return err
}
var alephData coreosAleph
var alephData map[string]any
if err := json.Unmarshal(contents, &alephData); err != nil {
return err
}
klog.Infof("CoreOS aleph version: mtime=%v build=%v imgid=%v\n", stat.ModTime().UTC(), alephData.Build, alephData.Imgid)
prettyAlephData, err := json.MarshalIndent(alephData, "", " ")
if err != nil {
klog.Fatalf("marshaling error: %s", err)
}
klog.Infof("CoreOS aleph version: mtime=%v\n%v", stat.ModTime().UTC(), string(prettyAlephData))
return nil
}

Expand Down Expand Up @@ -80,3 +79,7 @@ func logProvisioningInformation() {
klog.Warningf("Failed to get Ignition provisioning information: %v", err)
}
}

func main() {
logAlephInformation()
}

0 comments on commit fd01871

Please sign in to comment.