Remove default description in network DI modules (#28411)

This commit is contained in:
Ganesh Nalawade 2017-08-19 00:09:01 +05:30 committed by GitHub
commit c4b9dfe542
14 changed files with 140 additions and 280 deletions

View file

@ -143,8 +143,6 @@ from ansible.module_utils.ios import ios_argument_spec, check_args
from ansible.module_utils.netcfg import NetworkConfig
from ansible.module_utils.network_common import conditional, remove_default_spec
DEFAULT_DESCRIPTION = "configured by ios_interface"
def validate_mtu(value, module):
if value and not 64 <= int(value) <= 9600:
@ -284,13 +282,6 @@ def map_obj_to_commands(updates):
if candidate:
cmd = item + ' ' + str(candidate)
add_command_to_interface(interface, cmd, commands)
elif running:
# if value present in device is default value for
# interface, don't delete
if running == 'auto' and item in ('speed', 'duplex'):
continue
cmd = 'no ' + item + ' ' + str(running)
add_command_to_interface(interface, cmd, commands)
if disable and not obj_in_have.get('disable', False):
add_command_to_interface(interface, 'shutdown', commands)
@ -360,7 +351,7 @@ def main():
"""
element_spec = dict(
name=dict(),
description=dict(default=DEFAULT_DESCRIPTION),
description=dict(),
speed=dict(),
mtu=dict(),
duplex=dict(choices=['full', 'half', 'auto']),

View file

@ -93,6 +93,9 @@ EXAMPLES = """
aggregate:
- name: GigabitEthernet0/0/0/3
- name: GigabitEthernet0/0/0/2
speed: 100
duplex: full
mtu: 512
state: present
- name: Delete interface using aggregate
@ -139,8 +142,6 @@ from ansible.module_utils.iosxr import get_config, load_config
from ansible.module_utils.iosxr import iosxr_argument_spec, check_args
from ansible.module_utils.network_common import conditional, remove_default_spec
DEFAULT_DESCRIPTION = "configured by iosxr_interface"
def validate_mtu(value, module):
if value and not 64 <= int(value) <= 65535:
@ -182,7 +183,6 @@ def search_obj_in_list(name, lst):
def map_params_to_obj(module):
obj = []
args = ['name', 'description', 'speed', 'duplex', 'mtu']
aggregate = module.params.get('aggregate')
if aggregate:
@ -202,7 +202,7 @@ def map_params_to_obj(module):
obj.append(d)
else:
validate_param_values(module, args)
validate_param_values(module, module.params)
params = {
'name': module.params['name'],
'description': module.params['description'],
@ -279,9 +279,6 @@ def map_obj_to_commands(updates):
if candidate:
cmd = interface + ' ' + item + ' ' + str(candidate)
commands.append(cmd)
elif running:
cmd = 'no ' + interface + ' ' + item + ' ' + str(running)
commands.append(cmd)
if disable and not obj_in_have.get('disable', False):
commands.append(interface + ' shutdown')
@ -292,7 +289,6 @@ def map_obj_to_commands(updates):
value = w.get(item)
if value:
commands.append(interface + ' ' + item + ' ' + str(value))
if disable:
commands.append('no ' + interface + ' shutdown')
return commands
@ -354,7 +350,7 @@ def main():
"""
element_spec = dict(
name=dict(),
description=dict(default=DEFAULT_DESCRIPTION),
description=dict(),
speed=dict(),
mtu=dict(),
duplex=dict(choices=['full', 'half']),

View file

@ -170,7 +170,6 @@ except ImportError:
from xml.etree.ElementTree import tostring
USE_PERSISTENT_CONNECTION = True
DEFAULT_COMMENT = 'configured by junos_linkagg'
def validate_device_count(value, module):
@ -263,7 +262,7 @@ def main():
members=dict(type='list'),
min_links=dict(type='int'),
device_count=dict(type='int'),
description=dict(default=DEFAULT_COMMENT),
description=dict(),
state=dict(default='present', choices=['present', 'absent', 'up', 'down']),
active=dict(default=True, type='bool')
)

View file

@ -121,7 +121,6 @@ except ImportError:
from xml.etree.ElementTree import tostring
USE_PERSISTENT_CONNECTION = True
DEFAULT_DESCRIPTION = "configured by junos_vlan"
def validate_vlan_id(value, module):
@ -145,7 +144,7 @@ def main():
element_spec = dict(
name=dict(),
vlan_id=dict(type='int'),
description=dict(default=DEFAULT_DESCRIPTION),
description=dict(),
interfaces=dict(),
state=dict(default='present', choices=['present', 'absent']),
active=dict(default=True, type='bool')

View file

@ -138,8 +138,6 @@ 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
DEFAULT_DESCRIPTION = "'configured by vyos_interface'"
def search_obj_in_list(name, lst):
for o in lst:
@ -302,7 +300,7 @@ def main():
"""
element_spec = dict(
name=dict(),
description=dict(default=DEFAULT_DESCRIPTION),
description=dict(),
speed=dict(),
mtu=dict(type='int'),
duplex=dict(choices=['full', 'half', 'auto']),