tools: Do not append an empty list (pim_vrfs) to the config lines

If pim_vrfs is empty, we append [] into the lines array, and the reload is broken
since it expects only strings, but gets an array inside at the end.

```
Traceback (most recent call last):
  File "/usr/lib/frr/frr-reload.py", line 2227, in <module>
    log.debug("New Frr Config\n%s", newconf.get_lines())
  File "/usr/lib/frr/frr-reload.py", line 436, in get_lines
    return "\n".join(self.lines)
TypeError: sequence item 45: expected str instance, list found
```

Fixes: 98d47f43fb ("tools: Fix frr-reload to support legacy pim configuration from file")

Signed-off-by: Donatas Abraitis <donatas@opensourcerouting.org>
This commit is contained in:
Donatas Abraitis 2024-07-20 03:29:21 +03:00
parent 7aeb51e194
commit d022a4099c

View File

@ -400,6 +400,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()