From da6d56c37d3e571d72ef3fe226b5ce38ba9f1222 Mon Sep 17 00:00:00 2001
From: Christian Poessinger <christian@poessinger.com>
Date: Sat, 27 Nov 2021 20:10:19 +0100
Subject: frr: T3753: raise ConfigurationNotValid if commit loop counter is
 exceeded

---
 python/vyos/frr.py | 9 ++++++++-
 1 file changed, 8 insertions(+), 1 deletion(-)

diff --git a/python/vyos/frr.py b/python/vyos/frr.py
index 7bad2b0b6..e5253350a 100644
--- a/python/vyos/frr.py
+++ b/python/vyos/frr.py
@@ -456,12 +456,19 @@ class FRRConfig:
         # https://github.com/FRRouting/frr/issues/10132
         # https://github.com/FRRouting/frr/issues/10133
         count = 0
-        while count <= 5:
+        count_max = 5
+        while count < count_max:
             count += 1
             try:
                 reload_configuration('\n'.join(self.config), daemon=daemon)
+                break
             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')
+
 
     def modify_section(self, start_pattern, replacement='!', stop_pattern=r'\S+', remove_stop_mark=False, count=0):
         if isinstance(replacement, str):
-- 
cgit v1.2.3