mirror of
https://github.com/ghndrx/prowler.git
synced 2026-02-10 14:55:00 +00:00
feat(checks): Exclude checks with -e/--exclude-checks
* feat(checks): Select checks to run * feat(checks): Include tests * feat(checks): Exclude checks with -e * fix(checks): Include missing path * fix(checks): Include comments
This commit is contained in:
@@ -8,6 +8,12 @@ from lib.logger import logger
|
||||
from lib.outputs import report
|
||||
|
||||
|
||||
# Exclude checks to run
|
||||
def exclude_checks_to_run(checks_to_execute, excluded_checks):
|
||||
for check in excluded_checks:
|
||||
checks_to_execute.discard(check)
|
||||
return checks_to_execute
|
||||
|
||||
# Parse checks from file
|
||||
def parse_checks_from_file(checks_file):
|
||||
checks_to_execute = set()
|
||||
@@ -27,7 +33,7 @@ def parse_checks_from_file(checks_file):
|
||||
|
||||
def load_checks_to_execute(checks_file, check_list, provider):
|
||||
checks_to_execute = set()
|
||||
# LOADER
|
||||
|
||||
# Handle if there are checks passed using -c/--checks
|
||||
if check_list:
|
||||
for check_name in check_list:
|
||||
@@ -35,11 +41,8 @@ def load_checks_to_execute(checks_file, check_list, provider):
|
||||
|
||||
# Handle if there are checks passed using -C/--checks-file
|
||||
elif checks_file:
|
||||
# check if file exists or path
|
||||
# check permissions to read
|
||||
try:
|
||||
checks_to_execute = parse_checks_from_file(checks_file)
|
||||
|
||||
except Exception as e:
|
||||
logger.error(f"{checks_file}: {e.__class__.__name__}")
|
||||
|
||||
@@ -52,7 +55,7 @@ def load_checks_to_execute(checks_file, check_list, provider):
|
||||
# Format: "providers.{provider}.services.{service}.{check_name}.{check_name}"
|
||||
check_name = check_module.split(".")[-1]
|
||||
checks_to_execute.add(check_name)
|
||||
print(checks_to_execute)
|
||||
|
||||
return checks_to_execute
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user