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.
pull/22769/head
René Moser 8 years ago committed by GitHub
parent 991bf0a1c3
commit 24c617766c

@ -253,7 +253,7 @@ class AnsibleCloudStackLBRule(AnsibleCloudStack):
'account': self.get_account(key='name'),
'domainid': self.get_domain(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'),
'name': self.module.params.get('name'),
}

@ -227,7 +227,7 @@ class AnsibleCloudStackLBRuleMember(AnsibleCloudStack):
def get_rule(self):
args = self._get_common_args()
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'):
args['publicipid'] = self.get_ip_address(key='id')
rules = self.cs.listLoadBalancerRules(**args)

Loading…
Cancel
Save