diff --git a/cloudinit/cloud_config.go b/cloudinit/cloud_config.go index e857913..712eddc 100644 --- a/cloudinit/cloud_config.go +++ b/cloudinit/cloud_config.go @@ -10,8 +10,8 @@ import ( const DefaultSSHKeyName = "coreos-cloudinit" type CloudConfig struct { - SSH_Authorized_Keys []string - Coreos struct { + SSHAuthorizedKeys []string `yaml:"ssh_authorized_keys"` + Coreos struct { Etcd struct{ Discovery_URL string } Fleet struct{ Autostart bool } Units []Unit @@ -46,8 +46,8 @@ func ApplyCloudConfig(cfg CloudConfig, sshKeyName string) error { log.Printf("Set hostname to %s", cfg.Hostname) } - if len(cfg.SSH_Authorized_Keys) > 0 { - err := AuthorizeSSHKeys(sshKeyName, cfg.SSH_Authorized_Keys) + if len(cfg.SSHAuthorizedKeys) > 0 { + err := AuthorizeSSHKeys(sshKeyName, cfg.SSHAuthorizedKeys) if err == nil { log.Printf("Authorized SSH keys for core user") } else { diff --git a/cloudinit/cloud_config_test.go b/cloudinit/cloud_config_test.go index 3d2cfb6..1fe9a4f 100644 --- a/cloudinit/cloud_config_test.go +++ b/cloudinit/cloud_config_test.go @@ -12,7 +12,7 @@ func TestCloudConfigEmpty(t *testing.T) { t.Fatalf("Encountered unexpected error :%v", err) } - keys := cfg.SSH_Authorized_Keys + keys := cfg.SSHAuthorizedKeys if len(keys) != 0 { t.Error("Parsed incorrect number of SSH keys") } @@ -72,7 +72,7 @@ hostname: trontastic t.Fatalf("Encountered unexpected error :%v", err) } - keys := cfg.SSH_Authorized_Keys + keys := cfg.SSHAuthorizedKeys if len(keys) != 2 { t.Error("Parsed incorrect number of SSH keys") } else if keys[0] != "foobar" { @@ -150,7 +150,7 @@ ssh_authorized_keys: t.Fatalf("Encountered unexpected error :%v", err) } - keys := cfg.SSH_Authorized_Keys + keys := cfg.SSHAuthorizedKeys if len(keys) != 0 { t.Error("Parsed incorrect number of SSH keys") }