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
This commit is contained in:
parent
f16933492d
commit
67acffb5f2
1 changed files with 4 additions and 4 deletions
|
@ -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…
Reference in a new issue