Skip to content

Commit

Permalink
Handle vdb download exceptions. Disable non-depscan logging
Browse files Browse the repository at this point in the history
Signed-off-by: Prabhu Subramanian <[email protected]>
  • Loading branch information
prabhu committed Feb 19, 2025
1 parent 23286ee commit b6cd3c9
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 1 deletion.
2 changes: 2 additions & 0 deletions depscan/cli.py
Original file line number Diff line number Diff line change
Expand Up @@ -723,6 +723,8 @@ def run_depscan(args):
if db_lib.needs_update(days=0, hours=VDB_AGE_HOURS, default_status=db_lib.get_db_file_metadata is not None):
if ORAS_AVAILABLE:
LOG.debug(f"Downloading the latest vulnerability database to {config.DATA_DIR}. Please wait ...")
# This line may exit with an exception if the database cannot be downloaded.
# Example: urllib3.exceptions.IncompleteRead, urllib3.exceptions.ProtocolError, requests.exceptions.ChunkedEncodingError
download_image(vdb_database_url, config.DATA_DIR)
else:
LOG.warning("The latest vulnerability database is not found. Follow the documentation to manually download it.")
Expand Down
2 changes: 1 addition & 1 deletion depscan/lib/logger.py
Original file line number Diff line number Diff line change
Expand Up @@ -65,5 +65,5 @@ class CustomHighlighter(RegexHighlighter):
DEBUG = logging.DEBUG

for log_name, log_obj in logging.Logger.manager.loggerDict.items():
if log_name != __name__:
if not log_name.startswith("depscan"):
log_obj.disabled = True

0 comments on commit b6cd3c9

Please sign in to comment.