From 10723772b40c408fe9dae7be19ddfb3a2c9a659a Mon Sep 17 00:00:00 2001 From: Alex Goodman Date: Thu, 23 Jan 2025 12:40:09 -0500 Subject: [PATCH] wire up validations config Signed-off-by: Alex Goodman --- manager/src/grype_db_manager/cli/db.py | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/manager/src/grype_db_manager/cli/db.py b/manager/src/grype_db_manager/cli/db.py index c3604f5c..16f83cf1 100644 --- a/manager/src/grype_db_manager/cli/db.py +++ b/manager/src/grype_db_manager/cli/db.py @@ -137,7 +137,11 @@ def validate_db( _validate_db(ctx, cfg, db_info, images, db_uuid, recapture, force=force) if db_info.schema_version >= 6: - logging.info(f"validating latest.json {db_uuid}") + validations_enabled = db.schema.validations_enabled(db_info.schema_version) + if not validations_enabled and not force: + click.echo(f"{Format.BOLD}{Format.OKGREEN}Validation disabled, skipping{Format.RESET}") + return + _validate_latest(cfg, db_info.latest_path, db_info.archive_path) click.echo(f"{Format.BOLD}{Format.OKGREEN}Validation passed{Format.RESET}") @@ -266,6 +270,8 @@ def _validate_latest(cfg: config.Application, latest_file: str, archive_path: st msg = "minimum vulnerabilities must be specified" raise ValueError(msg) + logging.debug(f"validating latest.json with {cfg.validate.listing.image}") + db.latest.smoke_test( latest_obj, archive_path,