File tree Expand file tree Collapse file tree 1 file changed +4
-4
lines changed
Expand file tree Collapse file tree 1 file changed +4
-4
lines changed Original file line number Diff line number Diff line change @@ -17,11 +17,11 @@ limitations under the License.
1717package controller
1818
1919import (
20+ "encoding/json"
2021 "fmt"
2122
2223 config "github.com/coreos/ignition/v2/config/v3_4"
2324 "github.com/coreos/ignition/v2/config/v3_4/types"
24- "gopkg.in/yaml.v3"
2525 "sigs.k8s.io/controller-runtime/pkg/client"
2626)
2727
@@ -38,15 +38,15 @@ func modifyIgnitionConfig(ignitionData []byte, effectiveHostname string) ([]byte
3838 hostnameFound := false
3939 for i , file := range cfg .Storage .Files {
4040 if file .Path == "/etc/hostname" {
41- source := "data:," + effectiveHostname + "\n "
41+ source := "data:," + effectiveHostname + "%0A "
4242 cfg .Storage .Files [i ].Contents .Source = & source
4343 hostnameFound = true
4444 break
4545 }
4646 }
4747
4848 if ! hostnameFound {
49- source := "data:," + effectiveHostname + "\n "
49+ source := "data:," + effectiveHostname + "%0A "
5050 newFile := types.File {
5151 Node : types.Node {
5252 Path : "/etc/hostname" ,
@@ -64,7 +64,7 @@ func modifyIgnitionConfig(ignitionData []byte, effectiveHostname string) ([]byte
6464 cfg .Storage .Files = append (cfg .Storage .Files , newFile )
6565 }
6666
67- serialized , err := yaml .Marshal (& cfg )
67+ serialized , err := json .Marshal (& cfg )
6868 if err != nil {
6969 return []byte ("" ), fmt .Errorf ("failed to serialize Ignition config: %v" , err )
7070 }
You can’t perform that action at this time.
0 commit comments