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 }
|
Fleet struct{ Autostart bool }
|
||||||
Units []Unit
|
Units []Unit
|
||||||
}
|
}
|
||||||
Write_Files []WriteFile
|
WriteFiles []WriteFile `yaml:"write_files"`
|
||||||
Hostname string
|
Hostname string
|
||||||
}
|
}
|
||||||
|
|
||||||
func NewCloudConfig(contents []byte) (*CloudConfig, error) {
|
func NewCloudConfig(contents []byte) (*CloudConfig, error) {
|
||||||
@ -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
|
||||||
}
|
}
|
||||||
|
@ -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)
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user