cs_sshkeypair: fix ssh key rename (#36726)

* tests: cs_sshkeypair: add reproducer for failed key rename

* cs_sshkeypair: fix rename ssh key
This commit is contained in:
René Moser 2018-02-26 13:43:40 +01:00 committed by GitHub
parent 487ff1fe9b
commit cdb2969703
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 68 additions and 22 deletions

View file

@ -169,7 +169,7 @@ class AnsibleCloudStackSshKey(AnsibleCloudStack):
# We need to make another lookup if there is a key with identical name.
self.ssh_key = None
ssh_key = self.get_ssh_key()
if ssh_key['fingerprint'] != fingerprint:
if ssh_key and ssh_key['fingerprint'] != fingerprint:
args['name'] = name
self.query_api('deleteSSHKeyPair', **args)