Skip to content

Commit

Permalink
Merge pull request #16425 from opensourcerouting/fix/do_not_prepend_a…
Browse files Browse the repository at this point in the history
…n_empty_list_for_pim_vrfs

tools: Do not append an empty list (pim_vrfs) to the config lines
  • Loading branch information
Jafaral authored Jul 21, 2024
2 parents b681686 + 01b7bd3 commit 04b818d
Showing 1 changed file with 8 additions and 4 deletions.
12 changes: 8 additions & 4 deletions tools/frr-reload.py
Original file line number Diff line number Diff line change
Expand Up @@ -328,7 +328,10 @@ def load_from_file(self, filename):
vrf_context = re_vrf.group(1)

# 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):
router_pim = "router pim"
if re_pim.group(1):
Expand All @@ -340,7 +343,7 @@ def load_from_file(self, filename):
pim_vrfs.append(router_pim)
pim_vrfs.append(re_pim.group(2))
pim_vrfs.append("exit")
line="# PIM VRF LINE MOVED TO ROUTER PIM"
line = "# PIM VRF LINE MOVED TO ROUTER PIM"
else:
self.lines.append(router_pim)
self.lines.append(re_pim.group(2))
Expand All @@ -358,7 +361,7 @@ def load_from_file(self, filename):
pim_vrfs.append(router_pim)
pim_vrfs.append(re_pim.group(2))
pim_vrfs.append("exit")
line="# PIM VRF LINE MOVED TO ROUTER PIM"
line = "# PIM VRF LINE MOVED TO ROUTER PIM"
else:
self.lines.append(router_pim)
self.lines.append(re_pim.group(2))
Expand Down Expand Up @@ -400,7 +403,8 @@ def load_from_file(self, filename):

self.lines.append(line)

self.lines.append(pim_vrfs)
if len(pim_vrfs) > 0:
self.lines.append(pim_vrfs)

self.load_contexts()

Expand Down

0 comments on commit 04b818d

Please sign in to comment.