mirror of
https://github.com/ansible-collections/community.general.git
synced 2024-09-14 20:13:21 +02:00
cloudstack: fixes and improvements
cs_instance: fix case insensitivity cs_instance: remove duplicate code block cs_securitygroup_rule: fix KeyError on older ACS
This commit is contained in:
parent
badef2912b
commit
5430497151
2 changed files with 5 additions and 9 deletions
|
@ -500,7 +500,7 @@ class AnsibleCloudStackInstance(AnsibleCloudStack):
|
||||||
instances = self.cs.listVirtualMachines(**args)
|
instances = self.cs.listVirtualMachines(**args)
|
||||||
if instances:
|
if instances:
|
||||||
for v in instances['virtualmachine']:
|
for v in instances['virtualmachine']:
|
||||||
if instance_name in [ v['name'], v['displayname'], v['id'] ]:
|
if instance_name.lower() in [ v['name'].lower(), v['displayname'].lower(), v['id'] ]:
|
||||||
self.instance = v
|
self.instance = v
|
||||||
break
|
break
|
||||||
return self.instance
|
return self.instance
|
||||||
|
@ -668,12 +668,6 @@ class AnsibleCloudStackInstance(AnsibleCloudStack):
|
||||||
if self.module.params.get('ssh_key'):
|
if self.module.params.get('ssh_key'):
|
||||||
args_ssh_key['keypair'] = self.module.params.get('ssh_key')
|
args_ssh_key['keypair'] = self.module.params.get('ssh_key')
|
||||||
|
|
||||||
# SSH key data
|
|
||||||
args_ssh_key = {}
|
|
||||||
args_ssh_key['id'] = instance['id']
|
|
||||||
args_ssh_key['projectid'] = self.get_project(key='id')
|
|
||||||
if self.module.params.get('ssh_key'):
|
|
||||||
args_ssh_key['keypair'] = self.module.params.get('ssh_key')
|
|
||||||
|
|
||||||
if self._has_changed(args_service_offering, instance) or \
|
if self._has_changed(args_service_offering, instance) or \
|
||||||
self._has_changed(args_instance_update, instance) or \
|
self._has_changed(args_instance_update, instance) or \
|
||||||
|
|
|
@ -308,6 +308,7 @@ class AnsibleCloudStackSecurityGroupRule(AnsibleCloudStack):
|
||||||
res = None
|
res = None
|
||||||
sg_type = self.module.params.get('type')
|
sg_type = self.module.params.get('type')
|
||||||
if sg_type == 'ingress':
|
if sg_type == 'ingress':
|
||||||
|
if 'ingressrule' in security_group:
|
||||||
rule = self._get_rule(security_group['ingressrule'])
|
rule = self._get_rule(security_group['ingressrule'])
|
||||||
if not rule:
|
if not rule:
|
||||||
self.result['changed'] = True
|
self.result['changed'] = True
|
||||||
|
@ -315,6 +316,7 @@ class AnsibleCloudStackSecurityGroupRule(AnsibleCloudStack):
|
||||||
res = self.cs.authorizeSecurityGroupIngress(**args)
|
res = self.cs.authorizeSecurityGroupIngress(**args)
|
||||||
|
|
||||||
elif sg_type == 'egress':
|
elif sg_type == 'egress':
|
||||||
|
if 'egressrule' in security_group:
|
||||||
rule = self._get_rule(security_group['egressrule'])
|
rule = self._get_rule(security_group['egressrule'])
|
||||||
if not rule:
|
if not rule:
|
||||||
self.result['changed'] = True
|
self.result['changed'] = True
|
||||||
|
|
Loading…
Reference in a new issue