From 6f39fb47c3655bdfb28fed631e46936efcb65b97 Mon Sep 17 00:00:00 2001 From: n4ch04 Date: Fri, 18 Aug 2023 12:05:13 +0200 Subject: [PATCH] fix(check lib): delete comments and debug --- prowler/lib/check/check.py | 12 ++++++------ prowler/lib/check/models.py | 11 +---------- 2 files changed, 7 insertions(+), 16 deletions(-) diff --git a/prowler/lib/check/check.py b/prowler/lib/check/check.py index 289259e1af..31899e62ee 100644 --- a/prowler/lib/check/check.py +++ b/prowler/lib/check/check.py @@ -385,13 +385,13 @@ def import_check(check_path: str) -> ModuleType: def run_check(check: Check, output_options: Provider_Output_Options) -> list: findings = [] - if output_options.verbose: - print( - f"\nCheck ID: {check.check_metadata.CheckID} - {Fore.MAGENTA}{check.check_metadata.ServiceName}{Fore.YELLOW} [{check.check_metadata.Severity}]{Style.RESET_ALL}" - ) - logger.debug(f"Executing check: {check.check_metadata.CheckID}") + try: - print(check) + if output_options.verbose: + print( + f"\nCheck ID: {check.check_metadata.CheckID} - {Fore.MAGENTA}{check.check_metadata.ServiceName}{Fore.YELLOW} [{check.check_metadata.Severity}]{Style.RESET_ALL}" + ) + logger.debug(f"Executing check: {check.check_metadata.CheckID}") findings = check.execute() except Exception as error: if not output_options.only_logs: diff --git a/prowler/lib/check/models.py b/prowler/lib/check/models.py index ae6204a443..f03d32bd45 100644 --- a/prowler/lib/check/models.py +++ b/prowler/lib/check/models.py @@ -55,23 +55,14 @@ class Check_Metadata_Model(BaseModel): Compliance: list = None -class Check(ABC): # , Check_Metadata_Model): +class Check(ABC): """Prowler Check""" check_metadata: Check_Metadata_Model def __init__(self, metadata): """Check's init function. Calls the CheckMetadataModel init.""" - # # Parse the Check's metadata file - # metadata_file = ( - # os.path.abspath(sys.modules[self.__module__].__file__)[:-3] - # + ".metadata.json" - # ) - # # Store it to validate them with Pydantic - # data = Check_Metadata_Model.parse_file(metadata_file).dict() self.check_metadata = metadata - # Calls parents init function - # super().__init__(**data) def metadata(self) -> dict: """Return the JSON representation of the check's metadata"""