mirror of
https://github.com/ansible-collections/community.general.git
synced 2026-05-07 05:42:50 +00:00
cloudstack: use new get_result() handling
This commit is contained in:
@@ -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)
|
||||
|
||||
Reference in New Issue
Block a user