fix(sshKeyName): Use the SSH key name provided

This commit is contained in:
Alex Crawford 2014-06-18 11:40:13 -07:00
parent 160668284c
commit 259c7e1fe2
3 changed files with 4 additions and 4 deletions

View File

@ -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)

View File

@ -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 {

View File

@ -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