Merge pull request #444 from jasonberanek/ssh-fix

communicator/ssh, builder/digitalocean: fix new SSH API from upstream
This commit is contained in:
Mitchell Hashimoto 2013-09-20 09:17:09 -07:00
commit dfb4e80d57
2 changed files with 4 additions and 3 deletions

View File

@ -38,7 +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 := ssh.NewRSAPublicKey(&priv.PublicKey) // TODO properly handle the public key error
pub, _ := ssh.NewPublicKey(&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

View File

@ -60,9 +60,9 @@ func (k *SimpleKeychain) Key(i int) (ssh.PublicKey, error) {
} }
switch key := k.keys[i].(type) { switch key := k.keys[i].(type) {
case *rsa.PrivateKey: case *rsa.PrivateKey:
return ssh.NewRSAPublicKey(&key.PublicKey), nil return ssh.NewPublicKey(&key.PublicKey)
case *dsa.PrivateKey: case *dsa.PrivateKey:
return ssh.NewDSAPublicKey(&key.PublicKey), nil return ssh.NewPublicKey(&key.PublicKey)
} }
panic("unknown key type") panic("unknown key type")
} }