Skip to content
This repository has been archived by the owner on Apr 28, 2024. It is now read-only.

Commit

Permalink
Fixed COMBINED_UNWANTED_NAMES empty issue
Browse files Browse the repository at this point in the history
  • Loading branch information
Tchekda committed Feb 9, 2020
1 parent e0735b8 commit 28cd45e
Showing 1 changed file with 6 additions and 5 deletions.
11 changes: 6 additions & 5 deletions lg.py
Original file line number Diff line number Diff line change
Expand Up @@ -235,11 +235,12 @@ def whois():
SUMMARY_UNWANTED_PROTOS = ["Kernel", "Static", "Device", "BFD", "Direct", "RPKI"]
# Array of regular expressions to match against protocol names,
# and filter them from the summary view
SUMMARY_UNWANTED_NAMES = [ ]

# combine the unwanted names to a single regex
COMBINED_UNWANTED_NAMES = '(?:%s)' % '|'.join(SUMMARY_UNWANTED_NAMES)
SUMMARY_UNWANTED_NAMES = []

COMBINED_UNWANTED_NAMES = None
if len(SUMMARY_UNWANTED_NAMES) > 0 : # If regex list is not empty
# combine the unwanted names to a single regex
COMBINED_UNWANTED_NAMES = '(?:%s)' % '|'.join(SUMMARY_UNWANTED_NAMES)

@app.route("/summary/<hosts>")
@app.route("/summary/<hosts>/<proto>")
Expand Down Expand Up @@ -272,7 +273,7 @@ def summary(hosts, proto="ipv4"):
if (
len(split) >= 5 and
split[1] not in SUMMARY_UNWANTED_PROTOS and
not re.match(COMBINED_UNWANTED_NAMES, split[0])
(COMBINED_UNWANTED_NAMES is None or not re.match(COMBINED_UNWANTED_NAMES, split[0])) # If the list is empty or doesn't match the protocol name
):
props = dict()
props["name"] = split[0]
Expand Down

0 comments on commit 28cd45e

Please sign in to comment.