Merge pull request #7259 from darKoram/nova_keypair_check_keys
nova_keypair should fail if 'name' of key exists in keystore, but ssh hash value != public_key offered
This commit is contained in:
commit
0073b34653
1 changed files with 4 additions and 1 deletions
|
@ -115,7 +115,10 @@ def main():
|
|||
if module.params['state'] == 'present':
|
||||
for key in nova.keypairs.list():
|
||||
if key.name == module.params['name']:
|
||||
module.exit_json(changed = False, result = "Key present")
|
||||
if module.params['public_key'] and (module.params['public_key'] != key.public_key ):
|
||||
module.fail_json(msg = "name {} present but key hash not the same as offered. Delete key first.".format(key['name']))
|
||||
else:
|
||||
module.exit_json(changed = False, result = "Key present")
|
||||
try:
|
||||
key = nova.keypairs.create(module.params['name'], module.params['public_key'])
|
||||
except Exception, e:
|
||||
|
|
Loading…
Reference in a new issue