Skip to content

Commit

Permalink
controller: Deduplicate NewIgnFileBytesOverwriting code
Browse files Browse the repository at this point in the history
I don't know why I copy/pasted instead originally instead of just
having this call `NewIgnFileBytes()`.
  • Loading branch information
cgwalters committed May 3, 2022
1 parent 765e1f7 commit 8dce9a8
Showing 1 changed file with 4 additions and 13 deletions.
17 changes: 4 additions & 13 deletions pkg/controller/common/helpers.go
Original file line number Diff line number Diff line change
Expand Up @@ -798,7 +798,7 @@ func NewIgnFileBytes(path string, contents []byte) ign3types.File {
FileEmbedded1: ign3types.FileEmbedded1{
Contents: ign3types.Resource{
Source: strToPtr(dataurl.EncodeBytes(contents)),
Compression: strToPtr(""),
Compression: strToPtr(""), // See https://github.com/coreos/butane/issues/332
},
},
}
Expand All @@ -807,18 +807,9 @@ func NewIgnFileBytes(path string, contents []byte) ign3types.File {
// NewIgnFileBytesOverwriting is like NewIgnFileBytes, but overwrites existing files by default
func NewIgnFileBytesOverwriting(path string, contents []byte) ign3types.File {
overwrite := true
return ign3types.File{
Node: ign3types.Node{
Path: path,
Overwrite: &overwrite,
},
FileEmbedded1: ign3types.FileEmbedded1{
Contents: ign3types.Resource{
Source: strToPtr(dataurl.EncodeBytes(contents)),
Compression: strToPtr(""), // See https://github.com/coreos/butane/issues/332
},
},
}
r := NewIgnFileBytes(path, contents)
r.Node.Overwrite = &overwrite
return r
}

// GetIgnitionFileDataByPath retrieves the file data for a specified path from a given ignition config
Expand Down

0 comments on commit 8dce9a8

Please sign in to comment.