chore(clean output dirs): clean local output dirs with flag

This commit is contained in:
n4ch04
2023-11-30 17:27:30 +01:00
parent de4166bf0d
commit 89e54375e8
3 changed files with 14 additions and 1 deletions

View File

@@ -325,7 +325,8 @@ def prowler():
remove_custom_checks_module(checks_folder, provider)
# clean local directories
clean_provider_local_output_directories(args)
if args.clean_local_output_directories:
clean_provider_local_output_directories(args)
# If there are failed findings exit code 3, except if -z is input
if not args.ignore_exit_code_3 and stats["total_fail"] > 0:

View File

@@ -166,6 +166,12 @@ Detailed documentation at https://docs.prowler.cloud
default=False,
help="Set the output timestamp format as unix timestamps instead of iso format timestamps (default mode).",
)
common_outputs_parser.add_argument(
"--clean-local-output-directories",
action="store_true",
default=False,
help="Deletes local output directories when output reports are sent to external entities (i.e. S3 bucket)",
)
def __init_logging_parser__(self):
# Logging Options

View File

@@ -78,6 +78,7 @@ class Test_Parser:
assert not parsed.allowlist_file
assert not parsed.resource_tags
assert not parsed.ignore_unused_services
assert not parsed.clean_local_output_directories
def test_default_parser_no_arguments_azure(self):
provider = "azure"
@@ -298,6 +299,11 @@ class Test_Parser:
parsed = self.parser.parse(command)
assert parsed.unix_timestamp
def test_root_parser_clean_local_output_directories(self):
command = [prowler_command, "--clean-local-output-directories"]
parsed = self.parser.parse(command)
assert parsed.clean_local_output_directories
def test_logging_parser_only_logs_set(self):
command = [prowler_command, "--only-logs"]
parsed = self.parser.parse(command)