mirror of
https://github.com/ghndrx/prowler.git
synced 2026-02-10 14:55:00 +00:00
feat(exit_code 3): add -z option (#1848)
Co-authored-by: sergargar <sergargar@users.noreply.github.com>
This commit is contained in:
@@ -219,6 +219,10 @@ def prowler():
|
||||
audit_output_options.output_directory,
|
||||
)
|
||||
|
||||
# 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:
|
||||
sys.exit(3)
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
prowler()
|
||||
|
||||
@@ -138,6 +138,12 @@ Detailed documentation at https://docs.prowler.cloud
|
||||
action="store_true",
|
||||
help="Display detailed information about findings",
|
||||
)
|
||||
common_outputs_parser.add_argument(
|
||||
"-z",
|
||||
"--ignore-exit-code-3",
|
||||
action="store_true",
|
||||
help="Failed checks do not trigger exit code 3",
|
||||
)
|
||||
common_outputs_parser.add_argument(
|
||||
"-b", "--no-banner", action="store_true", help="Hide Prowler banner"
|
||||
)
|
||||
|
||||
@@ -146,6 +146,16 @@ class Test_Parser:
|
||||
parsed = self.parser.parse(command)
|
||||
assert parsed.quiet
|
||||
|
||||
def test_root_parser_exit_code_3_short(self):
|
||||
command = [prowler_command, "-z"]
|
||||
parsed = self.parser.parse(command)
|
||||
assert parsed.ignore_exit_code_3
|
||||
|
||||
def test_root_parser_exit_code_3_long(self):
|
||||
command = [prowler_command, "--ignore-exit-code-3"]
|
||||
parsed = self.parser.parse(command)
|
||||
assert parsed.ignore_exit_code_3
|
||||
|
||||
def test_root_parser_default_output_modes(self):
|
||||
command = [prowler_command]
|
||||
parsed = self.parser.parse(command)
|
||||
|
||||
Reference in New Issue
Block a user