fix(check lib): delete comments and debug

This commit is contained in:
n4ch04
2023-08-18 12:05:13 +02:00
parent b75226433c
commit 6f39fb47c3
2 changed files with 7 additions and 16 deletions

View File

@@ -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:

View File

@@ -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"""