Match VLAN ID as whole line instead of searching for digits in line (#51019)

Searching for digits somewhere in the output line will also match VLAN name (lines) starting with digits.

Fixes issue #50998
This commit is contained in:
Albert Siersema 2019-01-17 13:18:24 +01:00 committed by Trishna Guha
parent 22d914a888
commit b1c295386f

View file

@ -580,7 +580,7 @@ def map_config_to_obj(module):
if len(line) > 0: if len(line) > 0:
line = line.strip() line = line.strip()
if line[0].isdigit(): if line[0].isdigit():
match = re.search(r'(\d+)', line, re.M) match = re.search(r'^(\d+)$', line, re.M)
if match: if match:
v = match.group(1) v = match.group(1)
pos1 = splitted_line.index(v) pos1 = splitted_line.index(v)