Fixes to improve ios_system idempotency (#38303)

Added detection of additional formatting for domain_name, domain_search,
lookup_source, and lookup_enabled on some software versions. In each
case they failed to detect existing commands with a '-' in it.

Fix: #38301
pull/40157/head
Eric Thiel 7 years ago committed by Nathaniel Case
parent f16933492d
commit 67acffb5f2

@ -254,7 +254,7 @@ def parse_hostname(config):
def parse_domain_name(config):
match = re.findall(r'^ip domain name (?:vrf (\S+) )*(\S+)', config, re.M)
match = re.findall(r'^ip domain[- ]name (?:vrf (\S+) )*(\S+)', config, re.M)
matches = list()
for vrf, name in match:
if not vrf:
@ -264,7 +264,7 @@ def parse_domain_name(config):
def parse_domain_search(config):
match = re.findall(r'^ip domain list (?:vrf (\S+) )*(\S+)', config, re.M)
match = re.findall(r'^ip domain[- ]list (?:vrf (\S+) )*(\S+)', config, re.M)
matches = list()
for vrf, name in match:
if not vrf:
@ -285,7 +285,7 @@ def parse_name_servers(config):
def parse_lookup_source(config):
match = re.search(r'ip domain lookup source-interface (\S+)', config, re.M)
match = re.search(r'ip domain[- ]lookup source-interface (\S+)', config, re.M)
if match:
return match.group(1)
@ -297,7 +297,7 @@ def map_config_to_obj(module):
'domain_name': parse_domain_name(config),
'domain_search': parse_domain_search(config),
'lookup_source': parse_lookup_source(config),
'lookup_enabled': 'no ip domain lookup' not in config,
'lookup_enabled': 'no ip domain lookup' not in config and 'no ip domain-lookup' not in config,
'name_servers': parse_name_servers(config)
}

Loading…
Cancel
Save