]> git.puffer.fish Git - mirror/frr.git/commitdiff
tools: simplify excessively complex conditional 10048/head
authorQuentin Young <qlyoung@nvidia.com>
Fri, 12 Nov 2021 18:37:09 +0000 (13:37 -0500)
committerQuentin Young <qlyoung@nvidia.com>
Fri, 12 Nov 2021 18:37:09 +0000 (13:37 -0500)
Signed-off-by: Quentin Young <qlyoung@nvidia.com>
tools/frr-reload.py

index 435a0fbc254086d0d470d2df161804f7298b6fee..8762b956b6d5bd0c10ebf035f7320e5928133b25 100755 (executable)
@@ -1329,19 +1329,22 @@ def ignore_unconfigurable_lines(lines_to_add, lines_to_del):
 
     for (ctx_keys, line) in lines_to_del:
 
-        if (
-            ctx_keys[0].startswith("frr version")
-            or ctx_keys[0].startswith("frr defaults")
-            or ctx_keys[0].startswith("username")
-            or ctx_keys[0].startswith("password")
-            or ctx_keys[0].startswith("line vty")
-            or
-            # This is technically "no"able but if we did so frr-reload would
-            # stop working so do not let the user shoot themselves in the foot
-            # by removing this.
-            ctx_keys[0].startswith("service integrated-vtysh-config")
+        # The integrated-vtysh-config one is technically "no"able but if we did
+        # so frr-reload would stop working so do not let the user shoot
+        # themselves in the foot by removing this.
+        if any(
+            [
+                ctx_keys[0].startswith(x)
+                for x in [
+                    "frr version",
+                    "frr defaults",
+                    "username",
+                    "password",
+                    "line vty",
+                    "service integrated-vtysh-config",
+                ]
+            ]
         ):
-
             log.info('"%s" cannot be removed' % (ctx_keys[-1],))
             lines_to_del_to_del.append((ctx_keys, line))