Fix unwanted deprecation message in network module args (#28984)

* Fix unwanted deprecation message in network module argspec

Fixes #25663
Fixes #24537

*  segregate provider spec and top level arg spec
*  add deprecation key in top level arg spec
*  remove action plugin code to load provider and add
   that logic at a common place in network_common.py file

* Fix CI issue

* Minor change
This commit is contained in:
Ganesh Nalawade 2017-09-12 16:30:01 +05:30 committed by Ricardo Carrillo Cruz
commit 599fe23ed6
30 changed files with 283 additions and 634 deletions

View file

@ -40,26 +40,31 @@ ios_provider_spec = {
'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(fallback=(env_fallback, ['ANSIBLE_NET_AUTH_PASS']), no_log=True),
'timeout': dict(type='int'),
'timeout': dict(type='int')
}
ios_argument_spec = {
'provider': dict(type='dict', options=ios_provider_spec),
}
ios_argument_spec.update(ios_provider_spec)
ios_top_spec = {
'host': dict(removed_in_version=2.3),
'port': dict(removed_in_version=2.3, type='int'),
'username': dict(removed_in_version=2.3),
'password': dict(removed_in_version=2.3, no_log=True),
'ssh_keyfile': dict(removed_in_version=2.3, type='path'),
'authorize': dict(fallback=(env_fallback, ['ANSIBLE_NET_AUTHORIZE']), type='bool'),
'auth_pass': dict(removed_in_version=2.3, no_log=True),
'timeout': dict(removed_in_version=2.3, type='int')
}
ios_argument_spec.update(ios_top_spec)
def get_argspec():
return ios_argument_spec
def get_provider_argspec():
return ios_provider_spec
def check_args(module, warnings):
for key in ios_argument_spec:
if module._name == 'ios_user':
if key not in ['password', 'provider', 'authorize'] and module.params[key]:
warnings.append('argument %s has been deprecated and will be in a future version' % key)
else:
if key not in ['provider', 'authorize'] and module.params[key]:
warnings.append('argument %s has been deprecated and will be removed in a future version' % key)
pass
def get_defaults_flag(module):