Skip to content

Commit

Permalink
Merge pull request #192 from grycap/devel
Browse files Browse the repository at this point in the history
Try-cath the keypair deletion
  • Loading branch information
micafer committed Jan 26, 2017
2 parents 2294086 + c822d36 commit 0fa265a
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions IM/connectors/EC2.py
Original file line number Diff line number Diff line change
Expand Up @@ -1111,8 +1111,11 @@ def finalize(self, vm, auth_data):
public_key = vm.getRequestedSystem().getValue('disk.0.os.credentials.public_key')
if public_key is None or len(public_key) == 0 or (len(public_key) >= 1 and
public_key.find('-----BEGIN CERTIFICATE-----') != -1):
# only delete in case of the user do not specify the keypair name
conn.delete_key_pair(vm.keypair_name)
try:
# only delete in case of the user do not specify the keypair name
conn.delete_key_pair(vm.keypair_name)
except:
self.logger.exception("Error deleting keypair.")

# Delete the elastic IPs
try:
Expand Down

0 comments on commit 0fa265a

Please sign in to comment.