Skip to content

Commit

Permalink
exec/engine: log to journal only when available
Browse files Browse the repository at this point in the history
Alpine Linux does not include systemd’s journal, which causes Ignition
to emit warnings when attempting to log.  This PR introduces a check to
determine if the journal is available on the current distribution, and
skips logging to the journal when it is not present.

Signed-off-by: Kevin Cui <[email protected]>
  • Loading branch information
BlackHole1 committed Oct 24, 2024
1 parent 9871e7c commit f98f1ef
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 1 deletion.
1 change: 1 addition & 0 deletions docs/release-notes.md
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ nav_order: 9
- Fix network race when phoning home on Equinix Metal
- Fix Akamai Ignition base64 decoding on padded payloads
- Fix Makefile GOARCH for loongarch64 ([#1942](https://github.com/coreos/ignition/pull/1942))
- Fix Alpine distro print journal not beging available warn ([#1955](https://github.com/coreos/ignition/pull/1955))

## Ignition 2.19.0 (2024-06-05)

Expand Down
2 changes: 1 addition & 1 deletion internal/exec/engine.go
Original file line number Diff line number Diff line change
Expand Up @@ -179,7 +179,7 @@ func (e *Engine) acquireConfig(stageName string) (cfg types.Config, err error) {
cfg, err = e.acquireProviderConfig()

// if we've successfully fetched and cached the configs, log about them
if err == nil {
if err == nil && journal.Enabled() {
for _, cfgInfo := range e.State.FetchedConfigs {
if logerr := logStructuredJournalEntry(cfgInfo); logerr != nil {
e.Logger.Info("failed to log systemd journal entry: %v", logerr)
Expand Down

0 comments on commit f98f1ef

Please sign in to comment.