Skip to content

Commit

Permalink
Remove deprecated params from module argspec nxos modules (ansible#34911
Browse files Browse the repository at this point in the history
)

* Remove deprecated param from module argspec nxos modules

Signed-off-by: Trishna Guha <[email protected]>

* fix nxos_vrrp syntaxerror

* Add choices for version _nxos_ip_interface

* remove check_args function

* remove include_defaults
  • Loading branch information
trishnaguha authored Jan 16, 2018
1 parent 0196b6b commit a727930
Show file tree
Hide file tree
Showing 31 changed files with 85 additions and 254 deletions.
16 changes: 7 additions & 9 deletions lib/ansible/modules/network/nxos/_nxos_ip_interface.py
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,12 @@
- IPv4 or IPv6 Address.
required: false
default: null
version:
description:
- Version of IP address. If the IP address is IPV4 version should be v4.
If the IP address is IPV6 version should be v6.
default: v4
choices: ['v4', 'v6']
mask:
description:
- Subnet mask for IPv4 or IPv6 Address in decimal format.
Expand All @@ -73,11 +79,6 @@
required: false
default: false
version_added: "2.4"
include_defaults:
description:
- Specify if the complete running configuration for module operations should be used.
default: true
type: bool
state:
description:
- Specify desired state of the resource.
Expand Down Expand Up @@ -532,10 +533,7 @@ def main():
state=dict(required=False, default='present',
choices=['present', 'absent']),
allow_secondary=dict(required=False, default=False,
type='bool'),
include_defaults=dict(default=True),
config=dict(),
save=dict(type='bool', default=False)
type='bool')
)

argument_spec.update(nxos_argument_spec)
Expand Down
8 changes: 0 additions & 8 deletions lib/ansible/modules/network/nxos/_nxos_portchannel.py
Original file line number Diff line number Diff line change
Expand Up @@ -68,11 +68,6 @@
required: false
choices: ['true', 'false']
default: false
include_defaults:
description:
- Specify if the complete running configuration for module operations should be used.
default: false
type: bool
state:
description:
- Manage the state of the resource.
Expand Down Expand Up @@ -444,9 +439,6 @@ def main():
members=dict(required=False, default=None, type='list'),
force=dict(required=False, default='false', type='str', choices=['true', 'false']),
state=dict(required=False, choices=['absent', 'present'], default='present'),
include_defaults=dict(default=False),
config=dict(),
save=dict(type='bool', default=False)
)

argument_spec.update(nxos_argument_spec)
Expand Down
14 changes: 1 addition & 13 deletions lib/ansible/modules/network/nxos/nxos_acl.py
Original file line number Diff line number Diff line change
Expand Up @@ -192,11 +192,6 @@
choices: ['af11', 'af12', 'af13', 'af21', 'af22', 'af23','af31','af32',
'af33', 'af41', 'af42', 'af43', 'cs1', 'cs2', 'cs3', 'cs4',
'cs5', 'cs6', 'cs7', 'default', 'ef']
include_defaults:
description:
- Specify if the complete running configuration for module operations should be used.
default: false
type: bool
state:
description:
- Specify desired state of the resource.
Expand Down Expand Up @@ -433,14 +428,7 @@ def main():
'cs1', 'cs2', 'cs3', 'cs4',
'cs5', 'cs6', 'cs7', 'default',
'ef']),
state=dict(choices=['absent', 'present', 'delete_acl'], default='present'),
protocol=dict(choices=['http', 'https'], default='http'),
host=dict(required=True),
username=dict(type='str'),
password=dict(no_log=True, type='str'),
include_defaults=dict(default=False),
config=dict(),
save=dict(type='bool', default=False)
state=dict(choices=['absent', 'present', 'delete_acl'], default='present')
)

argument_spec.update(nxos_argument_spec)
Expand Down
4 changes: 4 additions & 0 deletions lib/ansible/modules/network/nxos/nxos_bgp.py
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,10 @@
required: false
choices: ['true','false']
default: null
bestpath_compare_neighborid:
description:
- Enable/Disable neighborid. Use this when more paths available than max path config.
choices: ['true', 'false']
bestpath_cost_community_ignore:
description:
- Enable/Disable Ignores the cost community for BGP best-path
Expand Down
3 changes: 1 addition & 2 deletions lib/ansible/modules/network/nxos/nxos_bgp_neighbor.py
Original file line number Diff line number Diff line change
Expand Up @@ -446,8 +446,7 @@ def main():
timers_holdtime=dict(required=False, type='str'),
transport_passive_only=dict(required=False, type='bool'),
update_source=dict(required=False, type='str'),
m_facts=dict(required=False, default=False, type='bool'),
state=dict(choices=['present', 'absent'], default='present', required=False),
state=dict(choices=['present', 'absent'], default='present', required=False)
)
argument_spec.update(nxos_argument_spec)

Expand Down
2 changes: 1 addition & 1 deletion lib/ansible/modules/network/nxos/nxos_config.py
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@
device config parser.
required: false
default: null
aliases: ['commands']
parents:
description:
- The ordered set of parents that uniquely identify the section
Expand Down Expand Up @@ -287,7 +288,6 @@
sample: /playbooks/ansible/backup/nxos_config.2016-07-16@22:28:34
"""

import os

from ansible.module_utils.basic import AnsibleModule
from ansible.module_utils.network.common.config import NetworkConfig, dumps
Expand Down
12 changes: 0 additions & 12 deletions lib/ansible/modules/network/nxos/nxos_evpn_global.py
Original file line number Diff line number Diff line change
Expand Up @@ -57,20 +57,9 @@
from ansible.module_utils.network.nxos.nxos import get_capabilities, nxos_argument_spec


def check_args(module, warnings):
for key in ('include_defaults', 'config', 'save'):
if module.params[key] is not None:
warnings.append('argument %s is no longer supported, ignoring value' % key)


def main():
argument_spec = dict(
nv_overlay_evpn=dict(required=True, type='bool'),

# deprecated in Ans2.3
include_defaults=dict(),
config=dict(),
save=dict()
)

argument_spec.update(nxos_argument_spec)
Expand All @@ -80,7 +69,6 @@ def main():
result = {'changed': False}

warnings = list()
check_args(module, warnings)
if warnings:
result['warnings'] = warnings

Expand Down
10 changes: 1 addition & 9 deletions lib/ansible/modules/network/nxos/nxos_evpn_vni.py
Original file line number Diff line number Diff line change
Expand Up @@ -74,11 +74,6 @@
- Sets the route-target 'import' extended communities.
required: false
default: null
include_defaults:
description:
- Specify if the complete running configuration for module operations should be used.
default: true
type: bool
state:
description:
- Determines whether the config should be present or not
Expand Down Expand Up @@ -243,10 +238,7 @@ def main():
route_target_both=dict(required=False, type='list'),
route_target_import=dict(required=False, type='list'),
route_target_export=dict(required=False, type='list'),
state=dict(choices=['present', 'absent'], default='present', required=False),
include_defaults=dict(default=True),
config=dict(),
save=dict(type='bool', default=False)
state=dict(choices=['present', 'absent'], default='present', required=False)
)

argument_spec.update(nxos_argument_spec)
Expand Down
14 changes: 1 addition & 13 deletions lib/ansible/modules/network/nxos/nxos_feature.py
Original file line number Diff line number Diff line change
Expand Up @@ -76,12 +76,6 @@
from ansible.module_utils.network.nxos.nxos import get_capabilities, nxos_argument_spec


def check_args(module, warnings):
for key in ('include_defaults', 'config', 'save'):
if module.params[key] is not None:
warnings.append('argument %s is no longer supported, ignoring value' % key)


def get_available_features(feature, module):
available_features = {}
feature_regex = r'(?P<feature>\S+)\s+\d+\s+(?P<state>.*)'
Expand Down Expand Up @@ -213,20 +207,14 @@ def validate_feature(module, mode='show'):
def main():
argument_spec = dict(
feature=dict(type='str', required=True),
state=dict(choices=['enabled', 'disabled'], default='enabled'),

# deprecated in Ans2.3
include_defaults=dict(),
config=dict(),
save=dict()
state=dict(choices=['enabled', 'disabled'], default='enabled')
)

argument_spec.update(nxos_argument_spec)

module = AnsibleModule(argument_spec=argument_spec, supports_check_mode=True)

warnings = list()
check_args(module, warnings)
results = dict(changed=False, warnings=warnings)

feature = validate_feature(module)
Expand Down
27 changes: 3 additions & 24 deletions lib/ansible/modules/network/nxos/nxos_gir_profile_management.py
Original file line number Diff line number Diff line change
Expand Up @@ -53,18 +53,6 @@
required: false
default: present
choices: ['present','absent']
include_defaults:
description:
- Specify to retrieve or not the complete running configuration
for module operations.
required: false
default: false
choices: ['true','false']
config:
description:
- Specify the configuration string to be used for module operations.
required: false
default: null
'''

EXAMPLES = '''
Expand All @@ -74,16 +62,11 @@
commands:
- router eigrp 11
- isolate
host: "{{ inventory_hostname }}"
username: "{{ un }}"
password: "{{ pwd }}"
# Remove the maintenance-mode profile
- nxos_gir_profile_management:
mode: maintenance
state: absent
host: "{{ inventory_hostname }}"
username: "{{ un }}"
password: "{{ pwd }}"
'''

RETURN = '''
Expand Down Expand Up @@ -120,7 +103,7 @@

import re
from ansible.module_utils.network.nxos.nxos import get_config, load_config, run_commands
from ansible.module_utils.network.nxos.nxos import nxos_argument_spec, check_args
from ansible.module_utils.network.nxos.nxos import nxos_argument_spec
from ansible.module_utils.basic import AnsibleModule
from ansible.module_utils.network.common.config import CustomNetworkConfig

Expand Down Expand Up @@ -175,10 +158,7 @@ def main():
argument_spec = dict(
commands=dict(required=False, type='list'),
mode=dict(required=True, choices=['maintenance', 'normal']),
state=dict(choices=['absent', 'present'],
default='present'),
include_defaults=dict(default=False),
config=dict()
state=dict(choices=['absent', 'present'], default='present')
)

argument_spec.update(nxos_argument_spec)
Expand All @@ -187,7 +167,6 @@ def main():
supports_check_mode=True)

warnings = list()
check_args(module, warnings)

state = module.params['state']
commands = module.params['commands'] or []
Expand Down
4 changes: 4 additions & 0 deletions lib/ansible/modules/network/nxos/nxos_hsrp.py
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,10 @@
- HSRP priority.
required: false
default: null
preempt:
description:
- Enable/Disable preempt.
choices: ['enabled', 'disabled']
vip:
description:
- HSRP virtual IP address.
Expand Down
15 changes: 1 addition & 14 deletions lib/ansible/modules/network/nxos/nxos_igmp.py
Original file line number Diff line number Diff line change
Expand Up @@ -59,11 +59,6 @@
required: false
default: null
choices: ['true', 'false']
include_defaults:
description:
- Specify if the complete running configuration for module operations should be used.
default: false
type: bool
state:
description:
- Manages desired state of the resource.
Expand All @@ -75,18 +70,15 @@
- name: Default igmp global params (all params except restart)
nxos_igmp:
state: default
host: "{{ inventory_hostname }}"
- name: Ensure the following igmp global config exists on the device
nxos_igmp:
flush_routes: true
enforce_rtr_alert: true
host: "{{ inventory_hostname }}"
- name: Restart the igmp process
nxos_igmp:
restart: true
host: "{{ inventory_hostname }}"
'''

RETURN = '''
Expand Down Expand Up @@ -121,12 +113,7 @@ def main():
flush_routes=dict(type='bool'),
enforce_rtr_alert=dict(type='bool'),
restart=dict(type='bool', default=False),

state=dict(choices=['present', 'default'], default='present'),

include_defaults=dict(default=False),
config=dict(),
save=dict(type='bool', default=False)
state=dict(choices=['present', 'default'], default='present')
)

argument_spec.update(nxos_argument_spec)
Expand Down
14 changes: 1 addition & 13 deletions lib/ansible/modules/network/nxos/nxos_igmp_interface.py
Original file line number Diff line number Diff line change
Expand Up @@ -159,11 +159,6 @@
required: false
choices: ['true', 'false']
default: null
include_defaults:
description:
- Specify if the complete running configuration for module operations should be used.
default: true
type: bool
state:
description:
- Manages desired state of the resource.
Expand All @@ -176,11 +171,7 @@
interface: ethernet1/32
startup_query_interval: 30
state: present
username: "{{ un }}"
password: "{{ pwd }}"
host: "{{ inventory_hostname }}"
'''

RETURN = '''
proposed:
description: k/v pairs of parameters passed into module
Expand Down Expand Up @@ -539,10 +530,7 @@ def main():
oif_source=dict(required=False, type='str'),
restart=dict(type='bool', default=False),
state=dict(choices=['present', 'absent', 'default'],
default='present'),
include_defaults=dict(default=True),
config=dict(),
save=dict(type='bool', default=False)
default='present')
)

argument_spec.update(nxos_argument_spec)
Expand Down
5 changes: 5 additions & 0 deletions lib/ansible/modules/network/nxos/nxos_interface.py
Original file line number Diff line number Diff line change
Expand Up @@ -129,6 +129,11 @@
required: true
default: present
choices: ['present','absent','default']
delay:
description:
- Time in seconds to wait before checking for the operational state on remote
device. This wait is applicable for operational state arguments.
default: 10
"""

EXAMPLES = """
Expand Down
Loading

0 comments on commit a727930

Please sign in to comment.