From 80c8b99a62e521ee7c5cd576ac43b3d462f4a432 Mon Sep 17 00:00:00 2001 From: Ricardo Carrillo Cruz Date: Fri, 27 Oct 2017 10:55:52 +0200 Subject: [PATCH] Handle ip name-server lines containing multiple nameservers (#32235) In CSR, multiple nameservers are defined in one line, whereas on IOS it's on multiple ones. This change handles both. --- lib/ansible/modules/network/ios/ios_system.py | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/lib/ansible/modules/network/ios/ios_system.py b/lib/ansible/modules/network/ios/ios_system.py index a5e1a2b2504..af7c801a333 100644 --- a/lib/ansible/modules/network/ios/ios_system.py +++ b/lib/ansible/modules/network/ios/ios_system.py @@ -266,12 +266,13 @@ def parse_domain_search(config): return matches def parse_name_servers(config): - match = re.findall('^ip name-server (?:vrf (\S+) )*(\S+)', config, re.M) + match = re.findall('^ip name-server (?:vrf (\S+) )*(.*)', config, re.M) matches = list() - for vrf, server in match: + for vrf, servers in match: if not vrf: vrf = None - matches.append({'server': server, 'vrf': vrf}) + for server in servers.split(): + matches.append({'server': server, 'vrf': vrf}) return matches def parse_lookup_source(config):