cloudstack: fix load balancer idempotency if no zone given

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.

(cherry picked from commit d1e8ef79ea)
pull/22783/head
Rene Moser 8 years ago
parent 5ae1967aea
commit 1799376ab7

@ -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