cloudstack: use new get_result() handling

This commit is contained in:
Rene Moser 2015-08-17 08:30:11 +02:00 committed by Matt Clay
parent 41315b2cd9
commit 65dc7af166
17 changed files with 207 additions and 416 deletions

View file

@ -77,6 +77,11 @@ EXAMPLES = '''
RETURN = '''
---
id:
description: UUID of the SSH public key.
returned: success
type: string
sample: a6f7a5fc-43f8-11e5-a151-feff819cdc9f
name:
description: Name of the SSH public key.
returned: success
@ -112,7 +117,11 @@ from ansible.module_utils.cloudstack import *
class AnsibleCloudStackSshKey(AnsibleCloudStack):
def __init__(self, module):
AnsibleCloudStack.__init__(self, module)
super(AnsibleCloudStackSshKey, self).__init__(module)
self.returns = {
'privatekey': 'private_key',
'fingerprint': 'fingerprint',
}
self.ssh_key = None
@ -189,16 +198,6 @@ class AnsibleCloudStackSshKey(AnsibleCloudStack):
return self.ssh_key
def get_result(self, ssh_key):
if ssh_key:
if 'fingerprint' in ssh_key:
self.result['fingerprint'] = ssh_key['fingerprint']
if 'name' in ssh_key:
self.result['name'] = ssh_key['name']
if 'privatekey' in ssh_key:
self.result['private_key'] = ssh_key['privatekey']
return self.result
def _get_ssh_fingerprint(self, public_key):
key = sshpubkeys.SSHKey(public_key)