don't attempt to delete non-existant key when using agent auth

This commit is contained in:
Matthew Hooker 2017-02-26 17:38:22 -08:00
parent f95514c120
commit 2cb9b32acf
No known key found for this signature in database
GPG Key ID: 7B5F933D9CE8C6A1
1 changed files with 1 additions and 1 deletions

View File

@ -107,7 +107,7 @@ func (s *StepKeyPair) Cleanup(state multistep.StateBag) {
// If no key name is set, then we never created it, so just return
// If we used an SSH private key file, do not go about deleting
// keypairs
if s.PrivateKeyFile != "" || s.KeyPairName != "" {
if s.PrivateKeyFile != "" || (s.KeyPairName == "" && s.keyName == "") {
return
}