Fix use of auto generated ssh key for scaleway builder
This commit is contained in:
parent
585b93cfd6
commit
c47e5d19f0
|
@ -18,7 +18,6 @@ func commHost(state multistep.StateBag) (string, error) {
|
||||||
|
|
||||||
func sshConfig(state multistep.StateBag) (*ssh.ClientConfig, error) {
|
func sshConfig(state multistep.StateBag) (*ssh.ClientConfig, error) {
|
||||||
config := state.Get("config").(Config)
|
config := state.Get("config").(Config)
|
||||||
var privateKey string
|
|
||||||
|
|
||||||
var auth []ssh.AuthMethod
|
var auth []ssh.AuthMethod
|
||||||
|
|
||||||
|
@ -45,11 +44,9 @@ func sshConfig(state multistep.StateBag) (*ssh.ClientConfig, error) {
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
if config.Comm.SSHPrivateKey != "" {
|
// Use key based auth if there is a private key in the state bag
|
||||||
if priv, ok := state.GetOk("private_key"); ok {
|
if privateKey, ok := state.GetOk("private_key"); ok {
|
||||||
privateKey = priv.(string)
|
signer, err := ssh.ParsePrivateKey([]byte(privateKey.(string)))
|
||||||
}
|
|
||||||
signer, err := ssh.ParsePrivateKey([]byte(privateKey))
|
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, fmt.Errorf("Error setting up SSH config: %s", err)
|
return nil, fmt.Errorf("Error setting up SSH config: %s", err)
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue