Commit 47797c2028 for frr

commit 47797c2028cb1e1f859f74b8547416b9b8d610e2
Author: Rafael Zalamena <rzalamena@opensourcerouting.org>
Date:   Sat Oct 10 16:51:46 2026 +0000

    tools: handle unload without error lines

    When the unload of a configuration fails without a line number we must
    fallback to remove each line.

    Signed-off-by: Rafael Zalamena <rzalamena@opensourcerouting.org>

diff --git a/tools/frr-reload.py b/tools/frr-reload.py
index f08cadd80b..a280a04229 100755
--- a/tools/frr-reload.py
+++ b/tools/frr-reload.py
@@ -39,6 +39,7 @@ class VtyshException(Exception):
     def __init__(self, *args, **kwargs):
         super(VtyshException, self).__init__(*args)
         self.stderr = kwargs.get("stderr", None)
+        self.stdout = kwargs.get("stdout", None)


 class Vtysh(object):
@@ -150,6 +151,7 @@ class Vtysh(object):
                 "vtysh (exec file) exited with status %d:\n%s"
                 % (child.returncode, combined),
                 stderr=err,
+                stdout=out,
             )
         # Success: stdout is the CLI session, stderr is vtysh warnings
         # (reconnect). Piping would otherwise drop both.
@@ -2919,6 +2921,7 @@ def exec_delete_lines(vtysh, rundir, entries):
         return True
     except VtyshException as e:
         failed_line_nums = get_failed_line_nums(e.stderr)
+        commit_failed = "% Configuration failed." in (e.stdout or "")
         log.info("Failed to execute deletion script due to\n%s" % (e,))
     finally:
         try:
@@ -2926,7 +2929,7 @@ def exec_delete_lines(vtysh, rundir, entries):
         except OSError:
             pass

-    if failed_line_nums:
+    if failed_line_nums and not commit_failed:
         retry = [
             entry
             for entry, (first, last) in zip(entries, entry_lines)