mirror of
https://github.com/ansible-collections/community.general.git
synced 2024-09-14 20:13:21 +02:00
cs_ip_address: use query_api, fixes error handling (#46034)
This commit is contained in:
parent
7f92a8c94c
commit
48b9992446
1 changed files with 3 additions and 3 deletions
|
@ -166,7 +166,7 @@ class AnsibleCloudStackIPAddress(AnsibleCloudStack):
|
||||||
'projectid': self.get_project(key='id'),
|
'projectid': self.get_project(key='id'),
|
||||||
'vpcid': self.get_vpc(key='id'),
|
'vpcid': self.get_vpc(key='id'),
|
||||||
}
|
}
|
||||||
ip_addresses = self.cs.listPublicIpAddresses(**args)
|
ip_addresses = self.query_api('listPublicIpAddresses', **args)
|
||||||
|
|
||||||
if ip_addresses:
|
if ip_addresses:
|
||||||
tags = self.module.params.get('tags')
|
tags = self.module.params.get('tags')
|
||||||
|
@ -201,7 +201,7 @@ class AnsibleCloudStackIPAddress(AnsibleCloudStack):
|
||||||
}
|
}
|
||||||
ip_address = None
|
ip_address = None
|
||||||
if not self.module.check_mode:
|
if not self.module.check_mode:
|
||||||
res = self.cs.associateIpAddress(**args)
|
res = self.query_api('associateIpAddress', **args)
|
||||||
|
|
||||||
poll_async = self.module.params.get('poll_async')
|
poll_async = self.module.params.get('poll_async')
|
||||||
if poll_async:
|
if poll_async:
|
||||||
|
@ -220,7 +220,7 @@ class AnsibleCloudStackIPAddress(AnsibleCloudStack):
|
||||||
self.module.params['tags'] = []
|
self.module.params['tags'] = []
|
||||||
ip_address = self.ensure_tags(resource=ip_address, resource_type='publicipaddress')
|
ip_address = self.ensure_tags(resource=ip_address, resource_type='publicipaddress')
|
||||||
|
|
||||||
res = self.cs.disassociateIpAddress(id=ip_address['id'])
|
res = self.query_api('disassociateIpAddress', id=ip_address['id'])
|
||||||
|
|
||||||
poll_async = self.module.params.get('poll_async')
|
poll_async = self.module.params.get('poll_async')
|
||||||
if poll_async:
|
if poll_async:
|
||||||
|
|
Loading…
Reference in a new issue