Skip to content

Commit 35bbdc3

Browse files
committed
Added tolower and fixed yaml outputs
1 parent 0f34970 commit 35bbdc3

File tree

1 file changed

+13
-5
lines changed

1 file changed

+13
-5
lines changed

pkg/converter/converter.go

+13-5
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ import (
1010
"runtime"
1111
"strings"
1212

13-
"gopkg.in/yaml.v2"
13+
"github.com/ghodss/yaml"
1414

1515
igntypes "github.com/coreos/ignition/config/v2_2/types"
1616
MachineConfig "github.com/openshift/machine-config-operator/pkg/apis/machineconfiguration.openshift.io/v1"
@@ -135,27 +135,35 @@ func CheckParameters(rawdata *Parameters) {
135135
nodetype = "worker"
136136
}
137137
r := strings.NewReplacer("/", "-", ".", "-")
138-
rawdata.Name = strings.TrimSpace(defaultMachineConfigPrefix + nodetype + r.Replace(rawdata.RemotePath))
138+
rawdata.Name = strings.ToLower(strings.TrimSpace(defaultMachineConfigPrefix + nodetype + r.Replace(rawdata.RemotePath)))
139139
log.Printf("name not provided, using '%s' as name\n", rawdata.Name)
140140
}
141+
} else {
142+
rawdata.Name = strings.ToLower(rawdata.Name)
141143
}
142144

143145
// Set label if not provided
144146
if rawdata.Labels == "" {
145147
log.Printf("labels not provided, using '%s' by default", defaultLabel)
146-
rawdata.Labels = defaultLabel
148+
rawdata.Labels = strings.ToLower(defaultLabel)
149+
} else {
150+
rawdata.Labels = strings.ToLower(rawdata.Labels)
147151
}
148152

149153
// Set filesystem if not provided
150154
if rawdata.Filesystem == "" {
151155
log.Printf("filesystem not provided, using '%s' by default", defaultFilesystem)
152-
rawdata.Filesystem = defaultFilesystem
156+
rawdata.Filesystem = strings.ToLower(defaultFilesystem)
157+
} else {
158+
rawdata.Filesystem = strings.ToLower(rawdata.Filesystem)
153159
}
154160

155161
// Set apiver if not provided
156162
if rawdata.APIVer == "" {
157163
log.Printf("apiver not provided, using '%s' by default", defaultApiversion)
158-
rawdata.APIVer = defaultApiversion
164+
rawdata.APIVer = strings.ToLower(defaultApiversion)
165+
} else {
166+
rawdata.APIVer = strings.ToLower(rawdata.APIVer)
159167
}
160168

161169
SetUserGroupMode(file, rawdata)

0 commit comments

Comments
 (0)