From 5204d7ca889e0f723c6b66eee13f3e479465fde0 Mon Sep 17 00:00:00 2001 From: Etienne CARRIERE Date: Wed, 3 Jun 2015 08:20:26 +0200 Subject: [PATCH] Add common fonctions for F5 modules (FQ Name functions) --- lib/ansible/module_utils/f5.py | 18 +++++++++++++++++- 1 file changed, 17 insertions(+), 1 deletion(-) diff --git a/lib/ansible/module_utils/f5.py b/lib/ansible/module_utils/f5.py index 2d97662a0b6..d072c759e2a 100644 --- a/lib/ansible/module_utils/f5.py +++ b/lib/ansible/module_utils/f5.py @@ -50,7 +50,7 @@ def f5_parse_arguments(module): module.fail_json(msg="the python bigsuds module is required") if not module.params['validate_certs']: disable_ssl_cert_validation() - return (module.params['server'],module.params['user'],module.params['password'],module.params['state'],module.params['partition']) + return (module.params['server'],module.params['user'],module.params['password'],module.params['state'],module.params['partition'],module.params['validate_certs']) def bigip_api(bigip, user, password): api = bigsuds.BIGIP(hostname=bigip, username=user, password=password) @@ -62,3 +62,19 @@ def disable_ssl_cert_validation(): import ssl ssl._create_default_https_context = ssl._create_unverified_context +# Fully Qualified name (with the partition) +def fq_name(partition,name): + if name is None: + return None + if name[0] is '/': + return name + else: + return '/%s/%s' % (partition,name) + +# Fully Qualified name (with partition) for a list +def fq_list_names(partition,list_names): + if list_names is None: + return None + return map(lambda x: fq_name(partition,x),list_names) + +