Merge pull request #16425 from opensourcerouting/fix/do_not_prepend_an_empty_list_for_pim_vrfs

tools: Do not append an empty list (pim_vrfs) to the config lines
This commit is contained in:
Jafar Al-Gharaibeh 2024-07-21 14:01:16 -04:00 committed by GitHub
commit 04b818dd4c
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -328,7 +328,10 @@ class Config(object):
vrf_context = re_vrf.group(1) vrf_context = re_vrf.group(1)
# Detect legacy pim commands that need to move under the router pim context # Detect legacy pim commands that need to move under the router pim context
re_pim = re.match("^ip(v6)? pim ((ecmp|join|keep|mlag|packets|register|rp|send|spt|ssm).*)$", line) re_pim = re.match(
"^ip(v6)? pim ((ecmp|join|keep|mlag|packets|register|rp|send|spt|ssm).*)$",
line,
)
if re_pim and re_pim.group(2): if re_pim and re_pim.group(2):
router_pim = "router pim" router_pim = "router pim"
if re_pim.group(1): if re_pim.group(1):
@ -400,6 +403,7 @@ class Config(object):
self.lines.append(line) self.lines.append(line)
if len(pim_vrfs) > 0:
self.lines.append(pim_vrfs) self.lines.append(pim_vrfs)
self.load_contexts() self.load_contexts()