1
0
Fork 0
mirror of https://github.com/ansible-collections/community.general.git synced 2024-09-14 20:13:21 +02:00

cloudstack: fix load balancer idempotency if no zone given (#22768)

get_zone() is special, as it always returns a zone (default zone) even
if no zone param is given. This makes sense for many use cases.
This commit is contained in:
René Moser 2017-03-19 10:07:46 +01:00 committed by GitHub
parent 991bf0a1c3
commit 24c617766c
2 changed files with 2 additions and 2 deletions

View file

@ -253,7 +253,7 @@ class AnsibleCloudStackLBRule(AnsibleCloudStack):
'account': self.get_account(key='name'), 'account': self.get_account(key='name'),
'domainid': self.get_domain(key='id'), 'domainid': self.get_domain(key='id'),
'projectid': self.get_project(key='id'), 'projectid': self.get_project(key='id'),
'zoneid': self.get_zone(key='id'), 'zoneid': self.get_zone(key='id') if self.module.params.get('zone') else None,
'publicipid': self.get_ip_address(key='id'), 'publicipid': self.get_ip_address(key='id'),
'name': self.module.params.get('name'), 'name': self.module.params.get('name'),
} }

View file

@ -227,7 +227,7 @@ class AnsibleCloudStackLBRuleMember(AnsibleCloudStack):
def get_rule(self): def get_rule(self):
args = self._get_common_args() args = self._get_common_args()
args['name'] = self.module.params.get('name') args['name'] = self.module.params.get('name')
args['zoneid'] = self.get_zone(key='id') args['zoneid'] = self.get_zone(key='id') if self.module.params.get('zone') else None
if self.module.params.get('ip_address'): if self.module.params.get('ip_address'):
args['publicipid'] = self.get_ip_address(key='id') args['publicipid'] = self.get_ip_address(key='id')
rules = self.cs.listLoadBalancerRules(**args) rules = self.cs.listLoadBalancerRules(**args)