1
0
Fork 0
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:
René Moser 2018-09-26 09:05:07 +02:00 committed by GitHub
parent 7f92a8c94c
commit 48b9992446
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -166,7 +166,7 @@ class AnsibleCloudStackIPAddress(AnsibleCloudStack):
'projectid': self.get_project(key='id'),
'vpcid': self.get_vpc(key='id'),
}
ip_addresses = self.cs.listPublicIpAddresses(**args)
ip_addresses = self.query_api('listPublicIpAddresses', **args)
if ip_addresses:
tags = self.module.params.get('tags')
@ -201,7 +201,7 @@ class AnsibleCloudStackIPAddress(AnsibleCloudStack):
}
ip_address = None
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')
if poll_async:
@ -220,7 +220,7 @@ class AnsibleCloudStackIPAddress(AnsibleCloudStack):
self.module.params['tags'] = []
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')
if poll_async: