Repository: prowler-cloud/prowler
Pull request: fix(output bucket): solve IsADirectoryError using compliance flag
### Description

Solve `IsADirectoryError` when sending outputs to bucket using compliance flag.

### License

By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.


Problem statement:
[Bug]: IsADirectoryError error when saving output compliance report to S3 
### Steps to Reproduce

Command:
prowler aws -z -q -f us-east-1 -O <redacted> -D <redacted> --compliance cis_1.4_aws -R <redacted>
Provider: AWS
Environment: Organizations
Error: [File: outputs.py:219] 	[Module: outputs]	 CRITICAL: IsADirectoryError[216] -- [Errno 21] Is a directory: '/home/prowler/output/'

The error does not occur if no "--compliance" argument is given.

### Expected behavior

Prowler should upload reports and exit with zero error code given -z was provided.

### Actual Result with Screenshots or Logs

Please note that log is from version 3.2.4 and that the warning outputs are from modifications I made to observe values in the outputs module. It happens as the "output_mode" value is not covered by the outputs module so a empty filename is given as the input.

2023-03-21 18:40:58,090 [File: outputs.py:235] 	[Module: outputs]	 INFO: Extracting audit statistics...
2023-03-21 18:40:58,092 [File: outputs.py:206] 	[Module: outputs]	 WARNING: Output mode csv
2023-03-21 18:40:58,092 [File: outputs.py:207] 	[Module: outputs]	 WARNING: filename: prowler-output-796680174892-20230321184039.csv
2023-03-21 18:40:58,092 [File: outputs.py:208] 	[Module: outputs]	 INFO: Sending outputs to S3 bucket security-prowler-055208999328-us-east-1
2023-03-21 18:40:58,335 [File: outputs.py:206] 	[Module: outputs]	 WARNING: Output mode json
2023-03-21 18:40:58,335 [File: outputs.py:207] 	[Module: outputs]	 WARNING: filename: prowler-output-796680174892-20230321184039.json
2023-03-21 18:40:58,335 [File: outputs.py:208] 	[Module: outputs]	 INFO: Sending outputs to S3 bucket security-prowler-055208999328-us-east-1
2023-03-21 18:40:58,677 [File: outputs.py:206] 	[Module: outputs]	 WARNING: Output mode html
2023-03-21 18:40:58,677 [File: outputs.py:207] 	[Module: outputs]	 WARNING: filename: prowler-output-796680174892-20230321184039.html
2023-03-21 18:40:58,678 [File: outputs.py:208] 	[Module: outputs]	 INFO: Sending outputs to S3 bucket security-prowler-055208999328-us-east-1
2023-03-21 18:40:58,801 [File: outputs.py:206] 	[Module: outputs]	 WARNING: Output mode cis_1.4_aws
2023-03-21 18:40:58,801 [File: outputs.py:207] 	[Module: outputs]	 WARNING: filename: 
2023-03-21 18:40:58,801 [File: outputs.py:208] 	[Module: outputs]	 INFO: Sending outputs to S3 bucket security-prowler-055208999328-us-east-1
2023-03-21 18:40:58,813 [File: outputs.py:219] 	[Module: outputs]	 CRITICAL: IsADirectoryError[216] -- [Errno 21] Is a directory: '/home/prowler/output/'

### How did you install Prowler?

From pip package (pip install prowler)

### Environment Resource

1. EC2 instance / Docker container

### OS used

1. Amazon Linux 2023 container image

### Prowler version

3.2.4

### Pip version

21.3.1

### Context

_No response_

Hints from issue discussion:
Thank you reaching us out @roneystein ! We will solve this bug shortly.

Commit message: solve compliance error

Patch to review:
diff --git a/prowler/lib/outputs/outputs.py b/prowler/lib/outputs/outputs.py
index 4e574fbc9e..fae71f6179 100644
--- a/prowler/lib/outputs/outputs.py
+++ b/prowler/lib/outputs/outputs.py
@@ -210,6 +210,8 @@ def send_to_s3_bucket(
             filename = f"{output_filename}{json_asff_file_suffix}"
         elif output_mode == "html":
             filename = f"{output_filename}{html_file_suffix}"
+        else:  # Compliance output mode
+            return
         logger.info(f"Sending outputs to S3 bucket {output_bucket}")
         bucket_remote_dir = output_directory
         while "prowler/" in bucket_remote_dir:  # Check if it is not a custom directory


Code review comments:
diff_hunk: @@ -210,6 +210,8 @@ def send_to_s3_bucket(
             filename = f"{output_filename}{json_asff_file_suffix}"
         elif output_mode == "html":
             filename = f"{output_filename}{html_file_suffix}"
+        else:  # Compliance output mode
+            return
path: prowler/lib/outputs/outputs.py
text: @user1:
Why this? Why do we don't want to send compliance to S3?

@user1:
Also if you modify this function's behaviour please update the test to handle this case.

@author:
Done