tools: simplify excessively complex conditional

Signed-off-by: Quentin Young <qlyoung@nvidia.com>
This commit is contained in:
Quentin Young 2021-11-12 13:37:09 -05:00
parent d2863e4a6b
commit 6e09a5bfea

View File

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