Merge pull request #1462 from resmo/for-ansible

[2.0] cloudstack: cs_instance: fix case insensitivity
reviewable/pr18780/r1
Toshio Kuratomi 9 years ago
commit ff3386ebc4

@ -499,7 +499,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
@ -667,12 +667,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 \

@ -309,14 +309,16 @@ 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':
rule = self._get_rule(security_group['ingressrule']) if 'ingressrule' in security_group:
rule = self._get_rule(security_group['ingressrule'])
if not rule: if not rule:
self.result['changed'] = True self.result['changed'] = True
if not self.module.check_mode: if not self.module.check_mode:
res = self.cs.authorizeSecurityGroupIngress(**args) res = self.cs.authorizeSecurityGroupIngress(**args)
elif sg_type == 'egress': elif sg_type == 'egress':
rule = self._get_rule(security_group['egressrule']) if 'egressrule' in security_group:
rule = self._get_rule(security_group['egressrule'])
if not rule: if not rule:
self.result['changed'] = True self.result['changed'] = True
if not self.module.check_mode: if not self.module.check_mode:

Loading…
Cancel
Save