From 259c7e1fe2b993a41863ab4593bfae6fc98b83f7 Mon Sep 17 00:00:00 2001 From: Alex Crawford Date: Wed, 18 Jun 2014 11:40:13 -0700 Subject: [PATCH] fix(sshKeyName): Use the SSH key name provided --- coreos-cloudinit.go | 2 +- initialize/env.go | 4 ++-- initialize/env_test.go | 2 +- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/coreos-cloudinit.go b/coreos-cloudinit.go index 79d4c15..8c55202 100644 --- a/coreos-cloudinit.go +++ b/coreos-cloudinit.go @@ -89,7 +89,7 @@ func main() { } } - env := initialize.NewEnvironment("/", workspace) + env := initialize.NewEnvironment("/", workspace, sshKeyName) if len(userdataBytes) > 0 { if err := processUserdata(string(userdataBytes), env); err != nil { fmt.Printf("Failed resolving user-data: %v\n", err) diff --git a/initialize/env.go b/initialize/env.go index 7460c2d..b0ab3c1 100644 --- a/initialize/env.go +++ b/initialize/env.go @@ -15,12 +15,12 @@ type Environment struct { substitutions map[string]string } -func NewEnvironment(root, workspace string) *Environment { +func NewEnvironment(root, workspace, sshKeyName string) *Environment { substitutions := map[string]string{ "$public_ipv4": os.Getenv("COREOS_PUBLIC_IPV4"), "$private_ipv4": os.Getenv("COREOS_PRIVATE_IPV4"), } - return &Environment{root, workspace, DefaultSSHKeyName, substitutions} + return &Environment{root, workspace, sshKeyName, substitutions} } func (self *Environment) Workspace() string { diff --git a/initialize/env_test.go b/initialize/env_test.go index 432663b..f10a054 100644 --- a/initialize/env_test.go +++ b/initialize/env_test.go @@ -8,7 +8,7 @@ import ( func TestEnvironmentApply(t *testing.T) { os.Setenv("COREOS_PUBLIC_IPV4", "192.0.2.3") os.Setenv("COREOS_PRIVATE_IPV4", "192.0.2.203") - env := NewEnvironment("./", "./") + env := NewEnvironment("./", "./", "") input := `[Service] ExecStart=/usr/bin/echo "$public_ipv4" ExecStop=/usr/bin/echo $private_ipv4