mirror of
https://github.com/ansible-collections/community.general.git
synced 2025-10-04 23:44:00 -07:00
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:
parent
698fa37a44
commit
bf1a543f06
4 changed files with 44 additions and 6 deletions
|
@ -54,6 +54,11 @@ nxos_argument_spec = {
|
|||
'transport': dict(choices=['cli', 'nxapi'])
|
||||
}
|
||||
|
||||
# Add argument's default value here
|
||||
ARGS_DEFAULT_VALUE = {
|
||||
'timeout': 10
|
||||
}
|
||||
|
||||
def check_args(module, warnings):
|
||||
provider = module.params['provider'] or {}
|
||||
for key in nxos_argument_spec:
|
||||
|
@ -61,6 +66,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):
|
||||
|
@ -240,7 +252,7 @@ class Nxapi:
|
|||
|
||||
headers = {'Content-Type': 'application/json'}
|
||||
result = list()
|
||||
timeout = self._module.params['timeout'] or 10
|
||||
timeout = self._module.params['timeout']
|
||||
|
||||
for req in requests:
|
||||
if self._nxapi_auth:
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue