]> git.puffer.fish Git - matthieu/frr.git/commitdiff
tools: fix key chain reload removal
authorRafael Zalamena <rzalamena@opensourcerouting.org>
Thu, 27 Jul 2023 13:47:23 +0000 (10:47 -0300)
committerChristian Breunig <christian@breunig.cc>
Wed, 7 Feb 2024 19:40:36 +0000 (20:40 +0100)
When deleting a key chain with frr-reload track if the whole root node
is being removed or not.

Signed-off-by: Rafael Zalamena <rzalamena@opensourcerouting.org>
(cherry picked from commit 96f76f7663e1294c64fb7ab4856140c619dc0e48)

tools/frr-reload.py

index 46ec2844ada2411e92a8226c4788666ffcc3bb81..83091cb4ab6a438d95c00f745ddb5e678b8e8075 100755 (executable)
@@ -1591,6 +1591,7 @@ def compare_context_objects(newconf, running):
     candidates_to_add = []
     delete_bgpd = False
     area_stub_no_sum = "area (\S+) stub no-summary"
+    deleted_keychains = []
 
     # Find contexts that are in newconf but not in running
     # Find contexts that are in running but not in newconf
@@ -1641,6 +1642,22 @@ def compare_context_objects(newconf, running):
             ):
                 continue
 
+            # Check if key chain is being deleted:
+            # - If it is being deleted then avoid deleting its contexts
+            # - Else delete its configuration without removing the root node
+            elif (
+                running_ctx_keys[0].startswith("key chain ")
+                and len(running_ctx_keys) == 1
+            ):
+                deleted_keychains.append(running_ctx_keys[0])
+                lines_to_del.append((running_ctx_keys, None))
+            elif (
+                running_ctx_keys[0].startswith("key chain ")
+                and len(running_ctx_keys) > 1
+                and running_ctx_keys[0] in deleted_keychains
+            ):
+                continue
+
             # Delete an entire vni sub-context under "address-family l2vpn evpn"
             elif (
                 "router bgp" in running_ctx_keys[0]