builder/digitalocean: fix dropped error on RSA key generation

This commit is contained in:
Lars Lehtonen 2019-11-08 10:35:48 -08:00
parent 643fce7b8a
commit 418152f23a
No known key found for this signature in database
GPG Key ID: 8137D474EBCB04F2
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)