From bfae3e1a439972cf17e0c8193a91e14e388367d8 Mon Sep 17 00:00:00 2001 From: Runar Borge Date: Tue, 25 Aug 2020 20:05:39 +0200 Subject: 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. --- python/vyos/frr.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) 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='!'): -- cgit v1.2.3