Make warning logs consistent (#23666)

* Make warning logs consistent

Arguments outside provider with default
value should not log as warning in case
it is not mentioned in play.

* Make nxos timeout default consistent and add comments

* Make comments more verbose
This commit is contained in:
Ganesh Nalawade 2017-04-18 21:59:38 +05:30 committed by GitHub
parent 698fa37a44
commit bf1a543f06
4 changed files with 44 additions and 6 deletions

View file

@ -36,11 +36,16 @@ junos_argument_spec = {
'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'),
'timeout': dict(type='int', default=10),
'timeout': dict(type='int'),
'provider': dict(type='dict'),
'transport': dict()
}
# Add argument's default value here
ARGS_DEFAULT_VALUE = {
'timeout': 10
}
def check_args(module, warnings):
provider = module.params['provider'] or {}
for key in junos_argument_spec:
@ -48,6 +53,13 @@ def check_args(module, warnings):
warnings.append('argument %s has been deprecated and will be '
'removed in a future version' % key)
# set argument's default value if not provided in input
# This is done to avoid unwanted argument deprecation warning
# in case argument is not given as input (outside provider).
for key in ARGS_DEFAULT_VALUE:
if not module.params.get(key, None):
module.params[key] = ARGS_DEFAULT_VALUE[key]
if provider:
for param in ('password',):
if provider.get(param):