removes args from the code and corrects few missed tests (#58175)

pull/58215/head
Wojciech Wypior 5 years ago committed by Tim Rupp
parent 56b3b1ac56
commit fbca93b8ad

@ -62,36 +62,6 @@ f5_argument_spec = {
'provider': dict(type='dict', options=f5_provider_spec),
}
f5_top_spec = {
'server': dict(
removed_in_version=2.9,
),
'user': dict(
removed_in_version=2.9,
),
'password': dict(
removed_in_version=2.9,
no_log=True,
aliases=['pass', 'pwd'],
),
'validate_certs': dict(
removed_in_version=2.9,
type='bool',
),
'server_port': dict(
removed_in_version=2.9,
type='int',
),
'transport': dict(
removed_in_version=2.9,
choices=['cli', 'rest']
),
'auth_provider': dict(
default=None
)
}
f5_argument_spec.update(f5_top_spec)
def get_provider_argspec():
return f5_provider_spec
@ -112,19 +82,6 @@ def is_empty_list(seq):
return False
# Fully Qualified name (with the partition)
def fqdn_name(partition, value):
"""This method is not used
This was the original name of a method that was used throughout all
the F5 Ansible modules. This is now deprecated, and should be removed
in 2.9. All modules should be changed to use ``fq_name``.
TODO(Remove in Ansible 2.9)
"""
return fq_name(partition, value)
def fq_name(partition, value, sub_path=''):
"""Returns a 'Fully Qualified' name
@ -187,7 +144,7 @@ def fq_name(partition, value, sub_path=''):
def fq_list_names(partition, list_names):
if list_names is None:
return None
return map(lambda x: fqdn_name(partition, x), list_names)
return map(lambda x: fq_name(partition, x), list_names)
def to_commands(module, commands):
@ -465,8 +422,6 @@ class F5BaseClient(object):
def merge_provider_server_param(self, result, provider):
if self.validate_params('server', provider):
result['server'] = provider['server']
elif self.validate_params('server', self.params):
result['server'] = self.params['server']
elif self.validate_params('F5_SERVER', os.environ):
result['server'] = os.environ['F5_SERVER']
else:
@ -475,8 +430,6 @@ class F5BaseClient(object):
def merge_provider_server_port_param(self, result, provider):
if self.validate_params('server_port', provider):
result['server_port'] = provider['server_port']
elif self.validate_params('server_port', self.params):
result['server_port'] = self.params['server_port']
elif self.validate_params('F5_SERVER_PORT', os.environ):
result['server_port'] = os.environ['F5_SERVER_PORT']
else:
@ -485,8 +438,6 @@ class F5BaseClient(object):
def merge_provider_validate_certs_param(self, result, provider):
if self.validate_params('validate_certs', provider):
result['validate_certs'] = provider['validate_certs']
elif self.validate_params('validate_certs', self.params):
result['validate_certs'] = self.params['validate_certs']
elif self.validate_params('F5_VALIDATE_CERTS', os.environ):
result['validate_certs'] = os.environ['F5_VALIDATE_CERTS']
else:
@ -499,8 +450,6 @@ class F5BaseClient(object):
def merge_provider_auth_provider_param(self, result, provider):
if self.validate_params('auth_provider', provider):
result['auth_provider'] = provider['auth_provider']
elif self.validate_params('auth_provider', self.params):
result['auth_provider'] = self.params['auth_provider']
elif self.validate_params('F5_AUTH_PROVIDER', os.environ):
result['auth_provider'] = os.environ['F5_AUTH_PROVIDER']
else:
@ -524,8 +473,6 @@ class F5BaseClient(object):
def merge_provider_user_param(self, result, provider):
if self.validate_params('user', provider):
result['user'] = provider['user']
elif self.validate_params('user', self.params):
result['user'] = self.params['user']
elif self.validate_params('F5_USER', os.environ):
result['user'] = os.environ.get('F5_USER')
elif self.validate_params('ANSIBLE_NET_USERNAME', os.environ):
@ -536,8 +483,6 @@ class F5BaseClient(object):
def merge_provider_password_param(self, result, provider):
if self.validate_params('password', provider):
result['password'] = provider['password']
elif self.validate_params('password', self.params):
result['password'] = self.params['password']
elif self.validate_params('F5_PASSWORD', os.environ):
result['password'] = os.environ.get('F5_PASSWORD')
elif self.validate_params('ANSIBLE_NET_PASSWORD', os.environ):

@ -7,42 +7,6 @@ class ModuleDocFragment(object):
# Standard F5 documentation fragment
DOCUMENTATION = r'''
options:
password:
description:
- The password for the user account used to connect to the BIG-IP.
- You may omit this option by setting the environment variable C(F5_PASSWORD).
type: str
required: true
aliases: [ pass, pwd ]
server:
description:
- The BIG-IP host.
- You may omit this option by setting the environment variable C(F5_SERVER).
type: str
required: true
server_port:
description:
- The BIG-IP server port.
- You may omit this option by setting the environment variable C(F5_SERVER_PORT).
type: int
default: 443
version_added: '2.2'
user:
description:
- The username to connect to the BIG-IP with. This user must have
administrative privileges on the device.
- You may omit this option by setting the environment variable C(F5_USER).
type: str
required: true
validate_certs:
description:
- If C(no), SSL certificates are not validated. Use this only
on personally controlled sites using self-signed certificates.
- You may omit this option by setting the environment variable
C(F5_VALIDATE_CERTS).
type: bool
default: yes
version_added: '2.0'
provider:
description:
- A dict object containing connection details.

@ -114,7 +114,6 @@ class TestManager(unittest.TestCase):
set_module_args(dict(
arp_log_level='debug',
layer4_log_level='debug',
password='admin',
provider=dict(
server='localhost',
password='password',

@ -127,9 +127,11 @@ class TestV1Manager(unittest.TestCase):
def test_ucs_default_present(self, *args):
set_module_args(dict(
ucs="/root/bigip.localhost.localdomain.ucs",
server='localhost',
password='password',
user='admin'
provider=dict(
server='localhost',
password='password',
user='admin'
)
))
module = AnsibleModule(

Loading…
Cancel
Save