Merge pull request #8354 from alrs/fix-do-ssh-key

builder/digitalocean: fix dropped error on RSA key generation
This commit is contained in:
Megan Marsh 2019-11-08 13:00:00 -08:00 committed by GitHub
commit be0e9f7816
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 6 additions and 0 deletions

View File

@ -33,6 +33,12 @@ func (s *stepCreateSSHKey) Run(ctx context.Context, state multistep.StateBag) mu
ui.Say("Creating temporary ssh key for droplet...")
priv, err := rsa.GenerateKey(rand.Reader, 2014)
if err != nil {
err := fmt.Errorf("error generating RSA key: %s", err)
state.Put("error", err)
ui.Error(err.Error())
return multistep.ActionHalt
}
// ASN.1 DER encoded form
priv_der := x509.MarshalPKCS1PrivateKey(priv)