Skip to content

Commit

Permalink
Remove confusing errors from bgpq3/bgpq4 output
Browse files Browse the repository at this point in the history
  • Loading branch information
pierky committed Jul 22, 2024
1 parent ab91aa3 commit 76d0d78
Showing 1 changed file with 17 additions and 5 deletions.
22 changes: 17 additions & 5 deletions pierky/arouteserver/irrdb.py
Original file line number Diff line number Diff line change
Expand Up @@ -169,11 +169,23 @@ def _run_cmd(self, cmd):
raise ValueError(err_msg)

if err is not None and err.strip():
logging.warning("{} succeeded but an error was "
"printed when executing '{}': {}".format(
self.bgpq,
" ".join(cmd), err.strip()
))
# If an error was returned, remove any line containing
# "Invalid AS number:". This is printed to stderr when
# private ASNs are found in the output, but it's just
# confusing and not useful for the user.
err_lines = err.strip().split("\n")
err = "\n".join([
line
for line in err_lines
if "Invalid AS number:" not in line
])

if err:
logging.warning("{} succeeded but an error was "
"printed when executing '{}': {}".format(
self.bgpq,
" ".join(cmd), err.strip()
))

return out

Expand Down

0 comments on commit 76d0d78

Please sign in to comment.