refactor(check_metadata): remove check metadata loading

This commit is contained in:
pedrooot
2024-09-26 17:08:29 +02:00
parent 8e0b715f12
commit 72bbafa344
3 changed files with 10 additions and 14 deletions
+1 -1
View File
@@ -135,7 +135,7 @@ def prowler():
sys.exit()
# Load checks metadata
logger.debug("Loading checks metadata from .metadata.json files")
logger.debug("Loading checks metadata from <check_name>.metadata.json files")
bulk_checks_metadata = CheckMetadata.get_bulk(provider)
if args.list_categories:
-12
View File
@@ -14,7 +14,6 @@ from colorama import Fore, Style
import prowler
from prowler.config.config import orange_color
from prowler.lib.check.custom_checks_metadata import update_check_metadata
from prowler.lib.check.models import Check
from prowler.lib.check.utils import recover_checks_from_provider
from prowler.lib.logger import logger
@@ -474,7 +473,6 @@ def execute_checks(
check_findings = execute(
check,
global_provider,
custom_checks_metadata,
output_options,
)
report(check_findings, global_provider, output_options)
@@ -554,7 +552,6 @@ def execute_checks(
check_findings = execute(
check,
global_provider,
custom_checks_metadata,
output_options,
)
@@ -602,7 +599,6 @@ def execute_checks(
def execute(
check: Check,
global_provider: Any,
custom_checks_metadata: Any,
output_options: Any = None,
):
"""
@@ -619,14 +615,6 @@ def execute(
list: list of findings
"""
try:
# Update check metadata to reflect that in the outputs
if custom_checks_metadata and custom_checks_metadata["Checks"].get(
check.CheckID
):
check = update_check_metadata(
check, custom_checks_metadata["Checks"][check.CheckID]
)
only_logs = False
if hasattr(output_options, "only_logs"):
only_logs = output_options.only_logs
+9 -1
View File
@@ -1,6 +1,7 @@
from typing import Generator
from prowler.lib.check.check import execute, import_check, update_audit_metadata
from prowler.lib.check.custom_checks_metadata import update_check_metadata
from prowler.lib.logger import logger
from prowler.lib.outputs.finding import Finding
from prowler.providers.common.models import Audit_Metadata
@@ -111,11 +112,18 @@ class Scan:
f"Check '{check_name}' was not found for the {self._provider.type.upper()} provider"
)
continue
# Update check metadata to reflect that in the outputs
if custom_checks_metadata and custom_checks_metadata["Checks"].get(
check.CheckID
):
check = update_check_metadata(
check, custom_checks_metadata["Checks"][check.CheckID]
)
# Execute the check
check_findings = execute(
check,
self._provider,
custom_checks_metadata,
output_options=None,
)