refactor(config): s/Write_Files/WriteFiles/g
This commit is contained in:
parent
6386b4830a
commit
99da4ba0af
@ -16,8 +16,8 @@ type CloudConfig struct {
|
||||
Fleet struct{ Autostart bool }
|
||||
Units []Unit
|
||||
}
|
||||
Write_Files []WriteFile
|
||||
Hostname string
|
||||
WriteFiles []WriteFile `yaml:"write_files"`
|
||||
Hostname string
|
||||
}
|
||||
|
||||
func NewCloudConfig(contents []byte) (*CloudConfig, error) {
|
||||
@ -55,8 +55,8 @@ func ApplyCloudConfig(cfg CloudConfig, sshKeyName string) error {
|
||||
}
|
||||
}
|
||||
|
||||
if len(cfg.Write_Files) > 0 {
|
||||
for _, file := range cfg.Write_Files {
|
||||
if len(cfg.WriteFiles) > 0 {
|
||||
for _, file := range cfg.WriteFiles {
|
||||
if err := ProcessWriteFile("/", &file); err != nil {
|
||||
return err
|
||||
}
|
||||
|
@ -25,8 +25,8 @@ func TestCloudConfigEmpty(t *testing.T) {
|
||||
t.Error("Expected AutostartFleet not to be defined")
|
||||
}
|
||||
|
||||
if len(cfg.Write_Files) != 0 {
|
||||
t.Error("Expected zero Write_Files")
|
||||
if len(cfg.WriteFiles) != 0 {
|
||||
t.Error("Expected zero WriteFiles")
|
||||
}
|
||||
|
||||
if cfg.Hostname != "" {
|
||||
@ -89,10 +89,10 @@ hostname: trontastic
|
||||
t.Error("Expected AutostartFleet to be true")
|
||||
}
|
||||
|
||||
if len(cfg.Write_Files) != 1 {
|
||||
if len(cfg.WriteFiles) != 1 {
|
||||
t.Error("Failed to parse correct number of write_files")
|
||||
} else {
|
||||
wf := cfg.Write_Files[0]
|
||||
wf := cfg.WriteFiles[0]
|
||||
if wf.Content != "penny\nelroy\n" {
|
||||
t.Errorf("WriteFile has incorrect contents '%s'", wf.Content)
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user