summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRunar Borge <runar@borge.nu>2020-08-25 20:05:39 +0200
committerRunar Borge <runar@borge.nu>2020-08-25 20:05:39 +0200
commitbfae3e1a439972cf17e0c8193a91e14e388367d8 (patch)
treefbb40e37902209128b5b32b90a319e0d9edbac66
parentffb3e2dc9df93c53abbd7ff0742ea75090d8c33d (diff)
downloadvyos-1x-bfae3e1a439972cf17e0c8193a91e14e388367d8.tar.gz
vyos-1x-bfae3e1a439972cf17e0c8193a91e14e388367d8.zip
T2826: frr: frr python lib error in replace_section
because of a bug in frr.py the default before_re will not be working. it is by default without a group, but will be used in a match that needs a group. The whole string could be matched in the group, so the fix is easy to implement.
-rw-r--r--python/vyos/frr.py2
1 files changed, 1 insertions, 1 deletions
diff --git a/python/vyos/frr.py b/python/vyos/frr.py
index e39b6a914..3fc75bbdf 100644
--- a/python/vyos/frr.py
+++ b/python/vyos/frr.py
@@ -281,7 +281,7 @@ def replace_section(config, replacement, from_re, to_re=r'!', before_re=r'line v
startline and endline tags will be automatically added to the resulting from_re/to_re and before_re regex'es
"""
- return _replace_section(config, replacement, replace_re=rf'^{from_re}$.*?^{to_re}$', before_re=rf'^{before_re}$')
+ return _replace_section(config, replacement, replace_re=rf'^{from_re}$.*?^{to_re}$', before_re=rf'^({before_re})$')
def remove_section(config, from_re, to_re='!'):