Skip to content

Commit

Permalink
Merge pull request #1789 from jlebon/pr/relabel-missing
Browse files Browse the repository at this point in the history
  • Loading branch information
jlebon committed Jan 16, 2024
2 parents 48524ec + 162d1a6 commit a7e36b7
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 3 deletions.
9 changes: 7 additions & 2 deletions docs/release-notes.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,17 +8,22 @@ nav_order: 9

### Breaking changes

- The dracut module is not automatically included in initramfs images anymore,
see distributor notes for details.
- Only include dracut module in initramfs if requested (see distributor notes
for details)

### Features



### Changes

- Require Go 1.20+

### Bug fixes

- Fix failure when config only disables units already disabled


## Ignition 2.17.0 (2023-11-20)

Starting with this release, ignition-validate binaries are signed with the
Expand Down
14 changes: 13 additions & 1 deletion internal/exec/stages/files/files.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ package files
import (
"errors"
"fmt"
"os"
"path/filepath"

"github.com/coreos/ignition/v2/config/v3_5_experimental/types"
Expand Down Expand Up @@ -170,7 +171,18 @@ func (s *stage) relabelFiles() error {

keys := make([]string, 0, len(s.toRelabel))
for key := range s.toRelabel {
keys = append(keys, key)
// Filter out non-existent entries; some of the code that mark files for
// relabeling may not actually end up creating those files in the end.
if _, err := os.Stat(key); err == nil {
keys = append(keys, key)
} else if !errors.Is(err, os.ErrNotExist) {
return err
}
}

if len(keys) == 0 {
return nil
}

return s.RelabelFiles(keys)
}

0 comments on commit a7e36b7

Please sign in to comment.