Fix nxos_system name-server parsing (#25973)

* Fix nxos_system name-server parsing

* Introduce lookup_source as a noop, but don't advertise its use
This commit is contained in:
Nathaniel Case 2017-07-17 11:15:43 -04:00 committed by GitHub
parent 855544604a
commit a3aa5d799e

View file

@ -87,10 +87,6 @@ EXAMPLES = """
nxos_system: nxos_system:
state: absent state: absent
- name: configure DNS lookup sources
nxos_system:
lookup_source: Management1
- name: configure name servers - name: configure name servers
nxos_system: nxos_system:
name_servers: name_servers:
@ -251,8 +247,9 @@ def parse_name_servers(config, vrf_config):
objects.append({'server': addr, 'vrf': None}) objects.append({'server': addr, 'vrf': None})
for vrf, cfg in iteritems(vrf_config): for vrf, cfg in iteritems(vrf_config):
for item in re.findall('ip name-server (\S+)', cfg, re.M): vrf_match = re.search('ip name-server (.+)', cfg, re.M)
for addr in match.group(1).split(' '): if vrf_match:
for addr in vrf_match.group(1).split(' '):
objects.append({'server': addr, 'vrf': vrf}) objects.append({'server': addr, 'vrf': vrf})
return objects return objects
@ -334,7 +331,7 @@ def main():
name_servers=dict(type='list'), name_servers=dict(type='list'),
system_mtu=dict(type='int'), system_mtu=dict(type='int'),
lookup_source=dict(),
state=dict(default='present', choices=['present', 'absent']) state=dict(default='present', choices=['present', 'absent'])
) )