summaryrefslogtreecommitdiff
path: root/python
diff options
context:
space:
mode:
authorkhramshinr <khramshinr@gmail.com>2024-03-19 17:50:11 +0800
committerMergify <37929162+mergify[bot]@users.noreply.github.com>2024-03-23 16:51:21 +0000
commit25252cdbfcef43980c2586a16f676e94f29a64bf (patch)
treebd363a64b5c446bf9b41d48656b5a0dcffaa06d7 /python
parenta72102b89566451bce40beb1ffdb5d2bf0b1dcc2 (diff)
downloadvyos-1x-25252cdbfcef43980c2586a16f676e94f29a64bf.tar.gz
vyos-1x-25252cdbfcef43980c2586a16f676e94f29a64bf.zip
bgp: T6106: Valid commit error for route-reflector-client option defined in peer-group
handle vtysh bgp error (cherry picked from commit 6fa72591972618f02ac1c66c084a99e006ce18f3)
Diffstat (limited to 'python')
-rw-r--r--python/vyos/frr.py16
1 files changed, 11 insertions, 5 deletions
diff --git a/python/vyos/frr.py b/python/vyos/frr.py
index a01d967e4..c3703cbb4 100644
--- a/python/vyos/frr.py
+++ b/python/vyos/frr.py
@@ -68,6 +68,7 @@ Apply the new configuration:
import tempfile
import re
+from vyos import ConfigError
from vyos.utils.permission import chown
from vyos.utils.process import cmd
from vyos.utils.process import popen
@@ -95,6 +96,7 @@ path_config = '/run/frr'
default_add_before = r'(ip prefix-list .*|route-map .*|line vty|end)'
+
class FrrError(Exception):
pass
@@ -210,13 +212,12 @@ def reload_configuration(config, daemon=None):
LOG.debug(f'reload_configuration: Executing command against frr-reload: "{cmd}"')
output, code = popen(cmd, stderr=STDOUT)
f.close()
+
for i, e in enumerate(output.split('\n')):
LOG.debug(f'frr-reload output: {i:3} {e}')
+
if code == 1:
- raise CommitError('FRR configuration failed while running commit. Please ' \
- 'enable debugging to examine logs.\n\n\n' \
- 'To enable debugging run: "touch /tmp/vyos.frr.debug" ' \
- 'and "sudo systemctl stop vyos-configd"')
+ raise ConfigError(output)
elif code:
raise OSError(code, output)
@@ -469,17 +470,22 @@ class FRRConfig:
# https://github.com/FRRouting/frr/issues/10133
count = 0
count_max = 5
+ emsg = ''
while count < count_max:
count += 1
try:
reload_configuration('\n'.join(self.config), daemon=daemon)
break
+ except ConfigError as e:
+ emsg = str(e)
except:
# we just need to re-try the commit of the configuration
# for the listed FRR issues above
pass
if count >= count_max:
- raise ConfigurationNotValid(f'Config commit retry counter ({count_max}) exceeded for {daemon} dameon!')
+ if emsg:
+ raise ConfigError(emsg)
+ raise ConfigurationNotValid(f'Config commit retry counter ({count_max}) exceeded for {daemon} daemon!')
# Save configuration to /run/frr/config/frr.conf
save_configuration()