cloudstack_ssh: register_ssh_key() set public_key as param
This commit is contained in:
parent
1d0ce5c5ea
commit
06cfffa35c
1 changed files with 5 additions and 4 deletions
|
@ -107,14 +107,14 @@ class AnsibleCloudStackSshKey(AnsibleCloudStack):
|
||||||
self.ssh_key = None
|
self.ssh_key = None
|
||||||
|
|
||||||
|
|
||||||
def register_ssh_key(self):
|
def register_ssh_key(self, public_key):
|
||||||
ssh_key = self.get_ssh_key()
|
ssh_key = self.get_ssh_key()
|
||||||
if not ssh_key:
|
if not ssh_key:
|
||||||
self.result['changed'] = True
|
self.result['changed'] = True
|
||||||
args = {}
|
args = {}
|
||||||
args['projectid'] = self.get_project_id()
|
args['projectid'] = self.get_project_id()
|
||||||
args['name'] = self.module.params.get('name')
|
args['name'] = self.module.params.get('name')
|
||||||
args['publickey'] = self.module.params.get('public_key')
|
args['publickey'] = public_key
|
||||||
if not self.module.check_mode:
|
if not self.module.check_mode:
|
||||||
ssh_key = self.cs.registerSSHKeyPair(**args)
|
ssh_key = self.cs.registerSSHKeyPair(**args)
|
||||||
return ssh_key
|
return ssh_key
|
||||||
|
@ -194,8 +194,9 @@ def main():
|
||||||
if state in ['absent']:
|
if state in ['absent']:
|
||||||
ssh_key = acs_sshkey.remove_ssh_key()
|
ssh_key = acs_sshkey.remove_ssh_key()
|
||||||
else:
|
else:
|
||||||
if module.params.get('public_key'):
|
public_key = module.params.get('public_key')
|
||||||
ssh_key = acs_sshkey.register_ssh_key()
|
if public_key:
|
||||||
|
ssh_key = acs_sshkey.register_ssh_key(public_key)
|
||||||
else:
|
else:
|
||||||
ssh_key = acs_sshkey.create_ssh_key()
|
ssh_key = acs_sshkey.create_ssh_key()
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue