nxos_system parse name_servers fix (#29944)

* nxos_system parse name_servers fix

Signed-off-by: Trishna Guha <trishnaguha17@gmail.com>

* fix nxos_system tests

Signed-off-by: Trishna Guha <trishnaguha17@gmail.com>
This commit is contained in:
Trishna Guha 2017-09-12 13:25:01 +05:30 committed by GitHub
parent 68aeaa58a8
commit 5b1c91bf19
3 changed files with 4 additions and 4 deletions

View file

@ -238,12 +238,14 @@ def parse_domain_search(config, vrf_config):
return objects
def parse_name_servers(config, vrf_config):
def parse_name_servers(config, vrf_config, vrfs):
objects = list()
match = re.search('^ip name-server (.+)$', config, re.M)
if match:
for addr in match.group(1).split(' '):
if addr == 'use-vrf' or addr in vrfs:
continue
objects.append({'server': addr, 'vrf': None})
for vrf, cfg in iteritems(vrf_config):
@ -275,7 +277,7 @@ def map_config_to_obj(module):
'domain_lookup': 'no ip domain-lookup' not in config,
'domain_name': parse_domain_name(config, vrf_config),
'domain_search': parse_domain_search(config, vrf_config),
'name_servers': parse_name_servers(config, vrf_config),
'name_servers': parse_name_servers(config, vrf_config, vrfs),
'system_mtu': parse_system_mtu(config)
}

View file

@ -22,7 +22,6 @@
- assert:
that:
- result.changed == true
- result.commands|length == 3
- "'ip name-server 1.1.1.1' in result.commands"
- "'ip name-server 2.2.2.2' in result.commands"
- "'ip name-server 3.3.3.3' in result.commands"

View file

@ -28,7 +28,6 @@
- assert:
that:
- result.changed == true
- result.commands|length == 3
- "'ip name-server 1.1.1.1' in result.commands"
- "'ip name-server 2.2.2.2' in result.commands"
- "'ip name-server 3.3.3.3' in result.commands"