refactor(config): s/Write_Files/WriteFiles/g

This commit is contained in:
Brian Waldon 2014-03-13 11:40:33 -07:00
parent 6386b4830a
commit 99da4ba0af
2 changed files with 8 additions and 8 deletions

View File

@ -16,7 +16,7 @@ type CloudConfig struct {
Fleet struct{ Autostart bool } Fleet struct{ Autostart bool }
Units []Unit Units []Unit
} }
Write_Files []WriteFile WriteFiles []WriteFile `yaml:"write_files"`
Hostname string Hostname string
} }
@ -55,8 +55,8 @@ func ApplyCloudConfig(cfg CloudConfig, sshKeyName string) error {
} }
} }
if len(cfg.Write_Files) > 0 { if len(cfg.WriteFiles) > 0 {
for _, file := range cfg.Write_Files { for _, file := range cfg.WriteFiles {
if err := ProcessWriteFile("/", &file); err != nil { if err := ProcessWriteFile("/", &file); err != nil {
return err return err
} }

View File

@ -25,8 +25,8 @@ func TestCloudConfigEmpty(t *testing.T) {
t.Error("Expected AutostartFleet not to be defined") t.Error("Expected AutostartFleet not to be defined")
} }
if len(cfg.Write_Files) != 0 { if len(cfg.WriteFiles) != 0 {
t.Error("Expected zero Write_Files") t.Error("Expected zero WriteFiles")
} }
if cfg.Hostname != "" { if cfg.Hostname != "" {
@ -89,10 +89,10 @@ hostname: trontastic
t.Error("Expected AutostartFleet to be true") 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") t.Error("Failed to parse correct number of write_files")
} else { } else {
wf := cfg.Write_Files[0] wf := cfg.WriteFiles[0]
if wf.Content != "penny\nelroy\n" { if wf.Content != "penny\nelroy\n" {
t.Errorf("WriteFile has incorrect contents '%s'", wf.Content) t.Errorf("WriteFile has incorrect contents '%s'", wf.Content)
} }