From c86b945a7cff32af8bcab937b85962f94b532884 Mon Sep 17 00:00:00 2001 From: Ganesh Nalawade Date: Fri, 22 Sep 2017 15:56:23 +0530 Subject: [PATCH] Remove check_args for vyos modules (#30739) * With addition of provider sub option validation check_args() is no longer required. --- lib/ansible/module_utils/vyos.py | 10 ---------- lib/ansible/modules/network/vyos/vyos_banner.py | 3 +-- lib/ansible/modules/network/vyos/vyos_command.py | 3 +-- lib/ansible/modules/network/vyos/vyos_config.py | 3 +-- lib/ansible/modules/network/vyos/vyos_facts.py | 3 +-- lib/ansible/modules/network/vyos/vyos_interface.py | 3 +-- lib/ansible/modules/network/vyos/vyos_l3_interface.py | 3 +-- lib/ansible/modules/network/vyos/vyos_linkagg.py | 3 +-- lib/ansible/modules/network/vyos/vyos_lldp.py | 3 +-- .../modules/network/vyos/vyos_lldp_interface.py | 3 +-- lib/ansible/modules/network/vyos/vyos_logging.py | 3 +-- lib/ansible/modules/network/vyos/vyos_static_route.py | 3 +-- lib/ansible/modules/network/vyos/vyos_system.py | 3 +-- lib/ansible/modules/network/vyos/vyos_user.py | 4 +--- 14 files changed, 13 insertions(+), 37 deletions(-) diff --git a/lib/ansible/module_utils/vyos.py b/lib/ansible/module_utils/vyos.py index 0aa9390538..72337d387b 100644 --- a/lib/ansible/module_utils/vyos.py +++ b/lib/ansible/module_utils/vyos.py @@ -62,16 +62,6 @@ def get_provider_argspec(): return vyos_provider_spec -def check_args(module, warnings): - for key in vyos_argument_spec: - 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 removed 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) - - def get_config(module, target='commands'): cmd = ' '.join(['show configuration', target]) diff --git a/lib/ansible/modules/network/vyos/vyos_banner.py b/lib/ansible/modules/network/vyos/vyos_banner.py index 69c2be6110..552273732e 100644 --- a/lib/ansible/modules/network/vyos/vyos_banner.py +++ b/lib/ansible/modules/network/vyos/vyos_banner.py @@ -88,7 +88,7 @@ import re from ansible.module_utils.basic import AnsibleModule from ansible.module_utils.vyos import get_config, load_config -from ansible.module_utils.vyos import vyos_argument_spec, check_args +from ansible.module_utils.vyos import vyos_argument_spec def spec_to_commands(updates, module): @@ -156,7 +156,6 @@ def main(): supports_check_mode=True) warnings = list() - check_args(module, warnings) result = {'changed': False} if warnings: diff --git a/lib/ansible/modules/network/vyos/vyos_command.py b/lib/ansible/modules/network/vyos/vyos_command.py index ac79f68c81..b998fd59ac 100644 --- a/lib/ansible/modules/network/vyos/vyos_command.py +++ b/lib/ansible/modules/network/vyos/vyos_command.py @@ -140,7 +140,7 @@ from ansible.module_utils.netcli import Conditional from ansible.module_utils.network_common import ComplexList from ansible.module_utils.six import string_types from ansible.module_utils.vyos import run_commands -from ansible.module_utils.vyos import vyos_argument_spec, check_args +from ansible.module_utils.vyos import vyos_argument_spec def to_lines(stdout): for item in stdout: @@ -184,7 +184,6 @@ def main(): module = AnsibleModule(argument_spec=spec, supports_check_mode=True) warnings = list() - check_args(module, warnings) commands = parse_commands(module, warnings) diff --git a/lib/ansible/modules/network/vyos/vyos_config.py b/lib/ansible/modules/network/vyos/vyos_config.py index b0ad4d8d9c..b1b09f48d1 100644 --- a/lib/ansible/modules/network/vyos/vyos_config.py +++ b/lib/ansible/modules/network/vyos/vyos_config.py @@ -129,7 +129,7 @@ import re from ansible.module_utils.basic import AnsibleModule from ansible.module_utils.netcfg import NetworkConfig from ansible.module_utils.vyos import load_config, get_config, run_commands -from ansible.module_utils.vyos import vyos_argument_spec, check_args +from ansible.module_utils.vyos import vyos_argument_spec DEFAULT_COMMENT = 'configured by vyos_config' @@ -260,7 +260,6 @@ def main(): ) warnings = list() - check_args(module, warnings) result = dict(changed=False, warnings=warnings) diff --git a/lib/ansible/modules/network/vyos/vyos_facts.py b/lib/ansible/modules/network/vyos/vyos_facts.py index 9aaf8ccaae..5a9637c892 100644 --- a/lib/ansible/modules/network/vyos/vyos_facts.py +++ b/lib/ansible/modules/network/vyos/vyos_facts.py @@ -101,7 +101,7 @@ import re from ansible.module_utils.basic import AnsibleModule from ansible.module_utils.six import iteritems from ansible.module_utils.vyos import run_commands -from ansible.module_utils.vyos import vyos_argument_spec, check_args +from ansible.module_utils.vyos import vyos_argument_spec class FactsBase(object): @@ -262,7 +262,6 @@ def main(): supports_check_mode=True) warnings = list() - check_args(module, warnings) gather_subset = module.params['gather_subset'] diff --git a/lib/ansible/modules/network/vyos/vyos_interface.py b/lib/ansible/modules/network/vyos/vyos_interface.py index 9b179456da..23b00e41ad 100644 --- a/lib/ansible/modules/network/vyos/vyos_interface.py +++ b/lib/ansible/modules/network/vyos/vyos_interface.py @@ -169,7 +169,7 @@ from ansible.module_utils.basic import AnsibleModule from ansible.module_utils.connection import exec_command from ansible.module_utils.network_common import conditional, remove_default_spec from ansible.module_utils.vyos import load_config, get_config -from ansible.module_utils.vyos import vyos_argument_spec, check_args +from ansible.module_utils.vyos import vyos_argument_spec def search_obj_in_list(name, lst): @@ -402,7 +402,6 @@ def main(): supports_check_mode=True) warnings = list() - check_args(module, warnings) result = {'changed': False} diff --git a/lib/ansible/modules/network/vyos/vyos_l3_interface.py b/lib/ansible/modules/network/vyos/vyos_l3_interface.py index 146ed3a800..8188d22e03 100644 --- a/lib/ansible/modules/network/vyos/vyos_l3_interface.py +++ b/lib/ansible/modules/network/vyos/vyos_l3_interface.py @@ -92,7 +92,7 @@ from copy import deepcopy from ansible.module_utils.basic import AnsibleModule from ansible.module_utils.network_common import remove_default_spec from ansible.module_utils.vyos import load_config, run_commands -from ansible.module_utils.vyos import vyos_argument_spec, check_args +from ansible.module_utils.vyos import vyos_argument_spec def search_obj_in_list(name, lst): @@ -218,7 +218,6 @@ def main(): supports_check_mode=True) warnings = list() - check_args(module, warnings) result = {'changed': False} diff --git a/lib/ansible/modules/network/vyos/vyos_linkagg.py b/lib/ansible/modules/network/vyos/vyos_linkagg.py index 48164de376..ed5e391bd6 100644 --- a/lib/ansible/modules/network/vyos/vyos_linkagg.py +++ b/lib/ansible/modules/network/vyos/vyos_linkagg.py @@ -100,7 +100,7 @@ from copy import deepcopy from ansible.module_utils.basic import AnsibleModule from ansible.module_utils.network_common import remove_default_spec from ansible.module_utils.vyos import load_config, run_commands -from ansible.module_utils.vyos import vyos_argument_spec, check_args +from ansible.module_utils.vyos import vyos_argument_spec def search_obj_in_list(name, lst): @@ -240,7 +240,6 @@ def main(): supports_check_mode=True) warnings = list() - check_args(module, warnings) result = {'changed': False} diff --git a/lib/ansible/modules/network/vyos/vyos_lldp.py b/lib/ansible/modules/network/vyos/vyos_lldp.py index 04f3dd5cac..df90a7db33 100644 --- a/lib/ansible/modules/network/vyos/vyos_lldp.py +++ b/lib/ansible/modules/network/vyos/vyos_lldp.py @@ -63,7 +63,7 @@ commands: """ from ansible.module_utils.basic import AnsibleModule from ansible.module_utils.vyos import get_config, load_config -from ansible.module_utils.vyos import vyos_argument_spec, check_args +from ansible.module_utils.vyos import vyos_argument_spec def has_lldp(module): @@ -91,7 +91,6 @@ def main(): supports_check_mode=True) warnings = list() - check_args(module, warnings) result = {'changed': False} diff --git a/lib/ansible/modules/network/vyos/vyos_lldp_interface.py b/lib/ansible/modules/network/vyos/vyos_lldp_interface.py index 3c39b3f08f..05fc02b489 100644 --- a/lib/ansible/modules/network/vyos/vyos_lldp_interface.py +++ b/lib/ansible/modules/network/vyos/vyos_lldp_interface.py @@ -93,7 +93,7 @@ from copy import deepcopy from ansible.module_utils.basic import AnsibleModule from ansible.module_utils.network_common import remove_default_spec from ansible.module_utils.vyos import get_config, load_config -from ansible.module_utils.vyos import vyos_argument_spec, check_args +from ansible.module_utils.vyos import vyos_argument_spec def search_obj_in_list(name, lst): @@ -203,7 +203,6 @@ def main(): supports_check_mode=True) warnings = list() - check_args(module, warnings) result = {'changed': False} diff --git a/lib/ansible/modules/network/vyos/vyos_logging.py b/lib/ansible/modules/network/vyos/vyos_logging.py index e432fec7ee..d544d1be33 100644 --- a/lib/ansible/modules/network/vyos/vyos_logging.py +++ b/lib/ansible/modules/network/vyos/vyos_logging.py @@ -110,7 +110,7 @@ from copy import deepcopy from ansible.module_utils.basic import AnsibleModule from ansible.module_utils.network_common import remove_default_spec from ansible.module_utils.vyos import get_config, load_config -from ansible.module_utils.vyos import vyos_argument_spec, check_args +from ansible.module_utils.vyos import vyos_argument_spec def spec_to_commands(updates, module): @@ -240,7 +240,6 @@ def main(): supports_check_mode=True) warnings = list() - check_args(module, warnings) result = {'changed': False} if warnings: diff --git a/lib/ansible/modules/network/vyos/vyos_static_route.py b/lib/ansible/modules/network/vyos/vyos_static_route.py index 6d65590307..ea71deecdd 100644 --- a/lib/ansible/modules/network/vyos/vyos_static_route.py +++ b/lib/ansible/modules/network/vyos/vyos_static_route.py @@ -108,7 +108,7 @@ from copy import deepcopy from ansible.module_utils.basic import AnsibleModule from ansible.module_utils.network_common import remove_default_spec from ansible.module_utils.vyos import get_config, load_config -from ansible.module_utils.vyos import vyos_argument_spec, check_args +from ansible.module_utils.vyos import vyos_argument_spec def spec_to_commands(updates, module): @@ -242,7 +242,6 @@ def main(): supports_check_mode=True) warnings = list() - check_args(module, warnings) result = {'changed': False} if warnings: diff --git a/lib/ansible/modules/network/vyos/vyos_system.py b/lib/ansible/modules/network/vyos/vyos_system.py index 0fc32a5bfd..2311750c09 100644 --- a/lib/ansible/modules/network/vyos/vyos_system.py +++ b/lib/ansible/modules/network/vyos/vyos_system.py @@ -94,7 +94,7 @@ EXAMPLES = """ from ansible.module_utils.basic import AnsibleModule from ansible.module_utils.vyos import get_config, load_config -from ansible.module_utils.vyos import vyos_argument_spec, check_args +from ansible.module_utils.vyos import vyos_argument_spec def spec_key_to_device_key(key): @@ -190,7 +190,6 @@ def main(): ) warnings = list() - check_args(module, warnings) result = {'changed': False, 'warnings': warnings} diff --git a/lib/ansible/modules/network/vyos/vyos_user.py b/lib/ansible/modules/network/vyos/vyos_user.py index 89dcbac607..8ff4705bc1 100644 --- a/lib/ansible/modules/network/vyos/vyos_user.py +++ b/lib/ansible/modules/network/vyos/vyos_user.py @@ -136,7 +136,7 @@ from ansible.module_utils.basic import AnsibleModule from ansible.module_utils.network_common import remove_default_spec from ansible.module_utils.vyos import get_config, load_config from ansible.module_utils.six import iteritems -from ansible.module_utils.vyos import vyos_argument_spec, check_args +from ansible.module_utils.vyos import vyos_argument_spec def validate_level(value, module): @@ -309,8 +309,6 @@ def main(): 'To set a user password use "configured_password" instead.' ) - check_args(module, warnings) - result = {'changed': False} if warnings: result['warnings'] = warnings