Fix nxos provider transport warning issue (#30610)

* Fix nxos provider transport warning issue

*  Add default value of transport arg in provider spec
*  Remove default value if transport arg in top level spec
   This ensure deprecation warning is seen only in case transport
   is given as a top level arg in task
*  Refactor nxos modules to reference transport value from provider
   spec

* Fix unit test

* Remove transport arg assignment in nxos action plugin

* As assigning transport value is handled in provider spec
  top level task arg assignment is no longer required
This commit is contained in:
Ganesh Nalawade 2017-09-22 10:32:25 +05:30 committed by GitHub
commit d72eb08902
13 changed files with 33 additions and 29 deletions

View file

@ -49,6 +49,7 @@ nxos_provider_spec = {
'use_ssl': dict(type='bool'),
'validate_certs': dict(type='bool'),
'timeout': dict(type='int'),
'transport': dict(default='cli', choices=['cli', 'nxapi'])
@ -68,7 +69,7 @@ nxos_top_spec = {
'validate_certs': dict(removed_in_version=2.9, type='bool'),
'timeout': dict(removed_in_version=2.9, type='int'),
'transport': dict(removed_in_version=2.9, default='cli', choices=['cli', 'nxapi'])
'transport': dict(removed_in_version=2.9, choices=['cli', 'nxapi'])
}
nxos_argument_spec.update(nxos_top_spec)
@ -84,7 +85,7 @@ def check_args(module, warnings):
def load_params(module):
provider = module.params.get('provider') or dict()
for key, value in iteritems(provider):
if key in nxos_argument_spec:
if key in nxos_provider_spec:
if module.params.get(key) is None and value is not None:
module.params[key] = value