Commit eaba28a3 authored by Mitchell Hashimoto's avatar Mitchell Hashimoto

communicator/ssh, builder/digitalocean: fix new SSH API from upstream

parent aee19167
...@@ -38,8 +38,8 @@ func (s *stepCreateSSHKey) Run(state multistep.StateBag) multistep.StepAction { ...@@ -38,8 +38,8 @@ func (s *stepCreateSSHKey) Run(state multistep.StateBag) multistep.StepAction {
state.Put("privateKey", string(pem.EncodeToMemory(&priv_blk))) state.Put("privateKey", string(pem.EncodeToMemory(&priv_blk)))
// Marshal the public key into SSH compatible format // Marshal the public key into SSH compatible format
pub := priv.PublicKey pub := ssh.NewRSAPublicKey(&priv.PublicKey)
pub_sshformat := string(ssh.MarshalAuthorizedKey(&pub)) pub_sshformat := string(ssh.MarshalAuthorizedKey(pub))
// The name of the public key on DO // The name of the public key on DO
name := fmt.Sprintf("packer-%s", hex.EncodeToString(identifier.NewUUID().Raw())) name := fmt.Sprintf("packer-%s", hex.EncodeToString(identifier.NewUUID().Raw()))
......
...@@ -7,6 +7,7 @@ import ( ...@@ -7,6 +7,7 @@ import (
"crypto/x509" "crypto/x509"
"encoding/pem" "encoding/pem"
"errors" "errors"
"code.google.com/p/go.crypto/ssh"
"io" "io"
) )
...@@ -53,15 +54,15 @@ func (k *SimpleKeychain) AddPEMKeyPassword(key string, password string) (err err ...@@ -53,15 +54,15 @@ func (k *SimpleKeychain) AddPEMKeyPassword(key string, password string) (err err
} }
// Key method for ssh.ClientKeyring interface // Key method for ssh.ClientKeyring interface
func (k *SimpleKeychain) Key(i int) (interface{}, error) { func (k *SimpleKeychain) Key(i int) (ssh.PublicKey, error) {
if i < 0 || i >= len(k.keys) { if i < 0 || i >= len(k.keys) {
return nil, nil return nil, nil
} }
switch key := k.keys[i].(type) { switch key := k.keys[i].(type) {
case *rsa.PrivateKey: case *rsa.PrivateKey:
return &key.PublicKey, nil return ssh.NewRSAPublicKey(&key.PublicKey), nil
case *dsa.PrivateKey: case *dsa.PrivateKey:
return &key.PublicKey, nil return ssh.NewDSAPublicKey(&key.PublicKey), nil
} }
panic("unknown key type") panic("unknown key type")
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment