fix(sshKeyName): Use the SSH key name provided
This commit is contained in:
		| @@ -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) | ||||
|   | ||||
| @@ -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 { | ||||
|   | ||||
| @@ -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 | ||||
|   | ||||
		Reference in New Issue
	
	Block a user