mirror of
https://github.com/ansible-collections/community.general.git
synced 2024-09-14 20:13:21 +02:00
cloudstack: use has_changed() from utils
This commit is contained in:
parent
aca98e2f8e
commit
43bee0b890
6 changed files with 8 additions and 8 deletions
|
@ -201,7 +201,7 @@ class AnsibleCloudStackDomain(AnsibleCloudStack):
|
||||||
args['id'] = domain['id']
|
args['id'] = domain['id']
|
||||||
args['networkdomain'] = self.module.params.get('network_domain')
|
args['networkdomain'] = self.module.params.get('network_domain')
|
||||||
|
|
||||||
if self._has_changed(args, domain):
|
if self.has_changed(args, domain):
|
||||||
self.result['changed'] = True
|
self.result['changed'] = True
|
||||||
if not self.module.check_mode:
|
if not self.module.check_mode:
|
||||||
res = self.cs.updateDomain(**args)
|
res = self.cs.updateDomain(**args)
|
||||||
|
|
|
@ -677,7 +677,7 @@ class AnsibleCloudStackInstance(AnsibleCloudStack):
|
||||||
args_service_offering['id'] = instance['id']
|
args_service_offering['id'] = instance['id']
|
||||||
if self.module.params.get('service_offering'):
|
if self.module.params.get('service_offering'):
|
||||||
args_service_offering['serviceofferingid'] = self.get_service_offering_id()
|
args_service_offering['serviceofferingid'] = self.get_service_offering_id()
|
||||||
service_offering_changed = self._has_changed(args_service_offering, instance)
|
service_offering_changed = self.has_changed(args_service_offering, instance)
|
||||||
|
|
||||||
# Instance data
|
# Instance data
|
||||||
args_instance_update = {}
|
args_instance_update = {}
|
||||||
|
@ -688,7 +688,7 @@ class AnsibleCloudStackInstance(AnsibleCloudStack):
|
||||||
args_instance_update['group'] = self.module.params.get('group')
|
args_instance_update['group'] = self.module.params.get('group')
|
||||||
if self.module.params.get('display_name'):
|
if self.module.params.get('display_name'):
|
||||||
args_instance_update['displayname'] = self.module.params.get('display_name')
|
args_instance_update['displayname'] = self.module.params.get('display_name')
|
||||||
instance_changed = self._has_changed(args_instance_update, instance)
|
instance_changed = self.has_changed(args_instance_update, instance)
|
||||||
|
|
||||||
# SSH key data
|
# SSH key data
|
||||||
args_ssh_key = {}
|
args_ssh_key = {}
|
||||||
|
@ -696,7 +696,7 @@ class AnsibleCloudStackInstance(AnsibleCloudStack):
|
||||||
args_ssh_key['projectid'] = self.get_project(key='id')
|
args_ssh_key['projectid'] = self.get_project(key='id')
|
||||||
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_changed = self._has_changed(args_ssh_key, instance)
|
ssh_key_changed = self.has_changed(args_ssh_key, instance)
|
||||||
|
|
||||||
security_groups_changed = self.security_groups_has_changed()
|
security_groups_changed = self.security_groups_has_changed()
|
||||||
|
|
||||||
|
|
|
@ -422,7 +422,7 @@ class AnsibleCloudStackNetwork(AnsibleCloudStack):
|
||||||
args = self._get_args()
|
args = self._get_args()
|
||||||
args['id'] = network['id']
|
args['id'] = network['id']
|
||||||
|
|
||||||
if self._has_changed(args, network):
|
if self.has_changed(args, network):
|
||||||
self.result['changed'] = True
|
self.result['changed'] = True
|
||||||
if not self.module.check_mode:
|
if not self.module.check_mode:
|
||||||
network = self.cs.updateNetwork(**args)
|
network = self.cs.updateNetwork(**args)
|
||||||
|
|
|
@ -320,7 +320,7 @@ class AnsibleCloudStackPortforwarding(AnsibleCloudStack):
|
||||||
args['ipaddressid'] = self.get_ip_address(key='id')
|
args['ipaddressid'] = self.get_ip_address(key='id')
|
||||||
args['virtualmachineid'] = self.get_vm(key='id')
|
args['virtualmachineid'] = self.get_vm(key='id')
|
||||||
|
|
||||||
if self._has_changed(args, portforwarding_rule):
|
if self.has_changed(args, portforwarding_rule):
|
||||||
self.result['changed'] = True
|
self.result['changed'] = True
|
||||||
if not self.module.check_mode:
|
if not self.module.check_mode:
|
||||||
# API broken in 4.2.1?, workaround using remove/create instead of update
|
# API broken in 4.2.1?, workaround using remove/create instead of update
|
||||||
|
|
|
@ -183,7 +183,7 @@ class AnsibleCloudStackProject(AnsibleCloudStack):
|
||||||
args['id'] = project['id']
|
args['id'] = project['id']
|
||||||
args['displaytext'] = self.get_or_fallback('display_text', 'name')
|
args['displaytext'] = self.get_or_fallback('display_text', 'name')
|
||||||
|
|
||||||
if self._has_changed(args, project):
|
if self.has_changed(args, project):
|
||||||
self.result['changed'] = True
|
self.result['changed'] = True
|
||||||
if not self.module.check_mode:
|
if not self.module.check_mode:
|
||||||
project = self.cs.updateProject(**args)
|
project = self.cs.updateProject(**args)
|
||||||
|
|
|
@ -217,7 +217,7 @@ class AnsibleCloudStackStaticNat(AnsibleCloudStack):
|
||||||
|
|
||||||
# make an alias, so we can use _has_changed()
|
# make an alias, so we can use _has_changed()
|
||||||
ip_address['vmguestip'] = ip_address['vmipaddress']
|
ip_address['vmguestip'] = ip_address['vmipaddress']
|
||||||
if self._has_changed(args, ip_address):
|
if self.has_changed(args, ip_address):
|
||||||
self.result['changed'] = True
|
self.result['changed'] = True
|
||||||
if not self.module.check_mode:
|
if not self.module.check_mode:
|
||||||
res = self.cs.disableStaticNat(ipaddressid=ip_address['id'])
|
res = self.cs.disableStaticNat(ipaddressid=ip_address['id'])
|
||||||
|
|
Loading…
Reference in a new issue