Skip to content

fix: update database before merging #1765

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Jul 11, 2022
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
56 changes: 28 additions & 28 deletions cve_bin_tool/cli.py
Original file line number Diff line number Diff line change
Expand Up @@ -436,34 +436,6 @@ def main(argv=None):
version_check = args["disable_version_check"]
db_update = args["update"]

# Check for PDF support
output_format = args["format"]
if output_format == "pdf" and importlib.util.find_spec("reportlab") is None:
LOGGER.info("PDF output not available. Default to console.")
LOGGER.info(
"If you want to produce PDF output, please install reportlab using pip install reportlab"
)
output_format = "console"

merged_reports = None
if args["merge"]:
LOGGER.info(
"You can use -f --format and -o --output-file for saving merged intermediate reports in a file"
)
merged_reports = MergeReports(
merge_files=args["merge"], score=score, filter_tag=args["filter"]
)
if args["input_file"]:
LOGGER.warning(
"Ignoring -i --input-file while merging intermediate reports"
)
args["input_file"] = None
merge_cve_scanner = merged_reports.merge_intermediate()
elif args["filter"] and not args["merge"]:
LOGGER.warning(
"Use -F --filter only when you want to filter out intermediate reports on the basis of tag"
)

source_nvd = nvd_source.NVD_Source(
nvd_type=args["nvd"],
incremental_update=True if db_update == "latest" and args["nvd"] else False,
Expand Down Expand Up @@ -537,6 +509,34 @@ def main(argv=None):

cvedb_orig.remove_cache_backup()

# Check for PDF support
output_format = args["format"]
if output_format == "pdf" and importlib.util.find_spec("reportlab") is None:
LOGGER.info("PDF output not available. Default to console.")
LOGGER.info(
"If you want to produce PDF output, please install reportlab using pip install reportlab"
)
output_format = "console"

merged_reports = None
if args["merge"]:
LOGGER.info(
"You can use -f --format and -o --output-file for saving merged intermediate reports in a file"
)
merged_reports = MergeReports(
merge_files=args["merge"], score=score, filter_tag=args["filter"]
)
if args["input_file"]:
LOGGER.warning(
"Ignoring -i --input-file while merging intermediate reports"
)
args["input_file"] = None
merge_cve_scanner = merged_reports.merge_intermediate()
elif args["filter"] and not args["merge"]:
LOGGER.warning(
"Use -F --filter only when you want to filter out intermediate reports on the basis of tag"
)

# Input validation
if (
not args["directory"]
Expand Down