From a5b905c941f0b5dbc7cd9e21e777fb8c26959a27 Mon Sep 17 00:00:00 2001 From: Trishna Guha Date: Wed, 28 Jun 2017 15:11:27 +0530 Subject: [PATCH] Workaround to deprecation warning when password is used as arg for *_user (#26169) * Avoid deprecation warning for password for vyos_user argspec Signed-off-by: Trishna Guha * Avoid Password deprecation for ios_user Signed-off-by: Trishna Guha * Avoid Password deprecation for iosxr_user Signed-off-by: Trishna Guha --- lib/ansible/module_utils/ios.py | 8 ++++++-- lib/ansible/module_utils/iosxr.py | 8 ++++++-- lib/ansible/module_utils/vyos.py | 8 ++++++-- 3 files changed, 18 insertions(+), 6 deletions(-) diff --git a/lib/ansible/module_utils/ios.py b/lib/ansible/module_utils/ios.py index 6ff369c484..d03c8f0600 100644 --- a/lib/ansible/module_utils/ios.py +++ b/lib/ansible/module_utils/ios.py @@ -52,8 +52,12 @@ def get_argspec(): def check_args(module, warnings): provider = module.params['provider'] or {} for key in ios_argument_spec: - 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) + 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) if provider: for param in ('auth_pass', 'password'): diff --git a/lib/ansible/module_utils/iosxr.py b/lib/ansible/module_utils/iosxr.py index 07ffe10738..630ec82553 100644 --- a/lib/ansible/module_utils/iosxr.py +++ b/lib/ansible/module_utils/iosxr.py @@ -51,8 +51,12 @@ def get_argspec(): def check_args(module, warnings): provider = module.params['provider'] or {} for key in iosxr_argument_spec: - if key != 'provider' and module.params[key]: - warnings.append('argument %s has been deprecated and will be removed in a future version' % key) + if module._name == 'iosxr_user': + if key not in ['password', 'provider'] and module.params[key]: + warnings.append('argument %s has been deprecated and will be in a future version' % key) + else: + if key != 'provider' and module.params[key]: + warnings.append('argument %s has been deprecated and will be removed in a future version' % key) if provider: for param in ('password',): diff --git a/lib/ansible/module_utils/vyos.py b/lib/ansible/module_utils/vyos.py index 881bfb8b87..b4db13ab7f 100644 --- a/lib/ansible/module_utils/vyos.py +++ b/lib/ansible/module_utils/vyos.py @@ -52,8 +52,12 @@ def get_argspec(): def check_args(module, warnings): provider = module.params['provider'] or {} for key in vyos_argument_spec: - if key != 'provider' and module.params[key]: - warnings.append('argument %s has been deprecated and will be removed in a future version' % key) + if module._name == 'vyos_user': + if key not in ['password', 'provider'] and module.params[key]: + warnings.append('argument %s has been deprecated and will be in a future version' % key) + else: + if key != 'provider' and module.params[key]: + warnings.append('argument %s has been deprecated and will be removed in a future version' % key) if provider: for param in ('password',):