From 4e8566739ea3c5fec7a7d70a59ddc55e55ab1c96 Mon Sep 17 00:00:00 2001 From: Tim Rupp Date: Tue, 13 Sep 2016 23:35:15 -0700 Subject: [PATCH] Fixes domains method not defined (#2907) The domains method was not defined, and therefore when specifying a parent domain during route domain creation, the process would fail. Tests have been added to detect this going forward --- .../extras/network/f5/bigip_routedomain.py | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) diff --git a/lib/ansible/modules/extras/network/f5/bigip_routedomain.py b/lib/ansible/modules/extras/network/f5/bigip_routedomain.py index bb71f850f57..552b20231cc 100644 --- a/lib/ansible/modules/extras/network/f5/bigip_routedomain.py +++ b/lib/ansible/modules/extras/network/f5/bigip_routedomain.py @@ -260,6 +260,20 @@ class BigIpRouteDomain(object): p['service_policy'] = str(r.servicePolicy) return p + def domains(self): + result = [] + + domains = self.api.tm.net.route_domains.get_collection() + for domain in domains: + # Just checking for the addition of the partition here for + # different versions of BIG-IP + if '/' + self.params['partition'] + '/' in domain.name: + result.append(domain.name) + else: + full_name = '/%s/%s' % (self.params['partition'], domain.name) + result.append(full_name) + return result + def create(self): params = dict() params['id'] = self.params['id'] @@ -284,7 +298,7 @@ class BigIpRouteDomain(object): if parent is not None: parent = '/%s/%s' % (partition, parent) - if parent in self.domains: + if parent in self.domains(): params['parent'] = parent else: raise F5ModuleError(