Merge pull request #11142 from Etienne-Carriere/factor_f5

Add common fonctions for F5 modules (FQ Name functions)
pull/11163/head
Brian Coca 10 years ago
commit f3ccff42e5

@ -50,7 +50,7 @@ def f5_parse_arguments(module):
module.fail_json(msg="the python bigsuds module is required") module.fail_json(msg="the python bigsuds module is required")
if not module.params['validate_certs']: if not module.params['validate_certs']:
disable_ssl_cert_validation() 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): def bigip_api(bigip, user, password):
api = bigsuds.BIGIP(hostname=bigip, username=user, password=password) api = bigsuds.BIGIP(hostname=bigip, username=user, password=password)
@ -62,3 +62,16 @@ def disable_ssl_cert_validation():
import ssl import ssl
ssl._create_default_https_context = ssl._create_unverified_context ssl._create_default_https_context = ssl._create_unverified_context
# Fully Qualified name (with the partition)
def fq_name(partition,name):
if name is not None and not name.startswith('/'):
return '/%s/%s' % (partition,name)
return 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)

Loading…
Cancel
Save