mirror of
https://github.com/ansible-collections/community.general.git
synced 2025-04-24 19:31:26 -07:00
Move networking provider options to subspec (#28894)
* Add EOS provider options as subspec * Add IOS provider options as subspec * Add IOS XR provider options as subspec * Add Junos provider options as subspec * Add NX-OS provider options as subspec * Add Vyos provider options as subspec * Remove password checks from check_args * Do the same to aireos, aruba, ce, dellos*, & sros, as they work the same way * VyOS does not support `transport`
This commit is contained in:
parent
3334407c71
commit
de2096e3d0
14 changed files with 66 additions and 101 deletions
|
@ -39,14 +39,13 @@ from ansible.module_utils.urls import fetch_url
|
|||
|
||||
_DEVICE_CONNECTION = None
|
||||
|
||||
eos_argument_spec = {
|
||||
eos_provider_spec = {
|
||||
'host': dict(),
|
||||
'port': dict(type='int'),
|
||||
'username': dict(fallback=(env_fallback, ['ANSIBLE_NET_USERNAME'])),
|
||||
'password': dict(fallback=(env_fallback, ['ANSIBLE_NET_PASSWORD']), no_log=True),
|
||||
'ssh_keyfile': dict(fallback=(env_fallback, ['ANSIBLE_NET_SSH_KEYFILE']), type='path'),
|
||||
|
||||
|
||||
'authorize': dict(fallback=(env_fallback, ['ANSIBLE_NET_AUTHORIZE']), type='bool'),
|
||||
'auth_pass': dict(no_log=True, fallback=(env_fallback, ['ANSIBLE_NET_AUTH_PASS'])),
|
||||
|
||||
|
@ -54,9 +53,12 @@ eos_argument_spec = {
|
|||
'validate_certs': dict(type='bool'),
|
||||
'timeout': dict(type='int'),
|
||||
|
||||
'provider': dict(type='dict'),
|
||||
'transport': dict(choices=['cli', 'eapi'])
|
||||
}
|
||||
eos_argument_spec = {
|
||||
'provider': dict(type='dict', options=eos_provider_spec),
|
||||
}
|
||||
eos_argument_spec.update(eos_provider_spec)
|
||||
|
||||
# Add argument's default value here
|
||||
ARGS_DEFAULT_VALUE = {
|
||||
|
@ -71,7 +73,6 @@ def get_argspec():
|
|||
|
||||
|
||||
def check_args(module, warnings):
|
||||
provider = module.params['provider'] or {}
|
||||
for key in eos_argument_spec:
|
||||
if module._name == 'eos_user':
|
||||
if (key not in ['username', 'password', 'provider', 'transport', 'authorize'] and
|
||||
|
@ -88,11 +89,6 @@ def check_args(module, warnings):
|
|||
if not module.params.get(key, None):
|
||||
module.params[key] = ARGS_DEFAULT_VALUE[key]
|
||||
|
||||
if provider:
|
||||
for param in ('auth_pass', 'password'):
|
||||
if provider.get(param):
|
||||
module.no_log_values.update(return_values(provider[param]))
|
||||
|
||||
|
||||
def load_params(module):
|
||||
provider = module.params.get('provider') or dict()
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue