From 67acffb5f2bfee20f757d02b91f3f76d0c131568 Mon Sep 17 00:00:00 2001 From: Eric Thiel <123.git1@shhhmail.com> Date: Tue, 15 May 2018 07:27:40 -0700 Subject: [PATCH] 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 --- lib/ansible/modules/network/ios/ios_system.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/lib/ansible/modules/network/ios/ios_system.py b/lib/ansible/modules/network/ios/ios_system.py index 75c3994f0e0..0d59fe8121d 100644 --- a/lib/ansible/modules/network/ios/ios_system.py +++ b/lib/ansible/modules/network/ios/ios_system.py @@ -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) }