Skip to content

Commit a9d9ef2

Browse files
Update modules/reporting/gcs.py
Co-authored-by: gemini-code-assist[bot] <176961590+gemini-code-assist[bot]@users.noreply.github.com>
1 parent 0be0ee0 commit a9d9ef2

File tree

1 file changed

+8
-4
lines changed

1 file changed

+8
-4
lines changed

modules/reporting/gcs.py

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -41,13 +41,17 @@ def run(self, results):
4141
return
4242

4343
# Read configuration options from gcs.conf
44+
# Read configuration options from gcs.conf and validate them
4445
bucket_name = self.options.get("bucket_name")
45-
credentials_path = self.options.get("credentials_path", "")
46-
credentials_path = os.path.join(CUCKOO_ROOT, credentials_path)
47-
# Validate configuration
4846
if not bucket_name:
4947
raise CuckooReportError("GCS bucket_name is not configured in reporting.conf -> gcs")
50-
if not credentials_path or not os.path.exists():
48+
49+
credentials_path_str = self.options.get("credentials_path")
50+
if not credentials_path_str:
51+
raise CuckooReportError("GCS credentials_path is not configured in reporting.conf -> gcs")
52+
53+
credentials_path = os.path.join(CUCKOO_ROOT, credentials_path_str)
54+
if not os.path.isfile(credentials_path):
5155
raise CuckooReportError(
5256
f"GCS credentials_path '{credentials_path}' is invalid or file does not exist in reporting.conf -> gcs"
5357
)

0 commit comments

Comments
 (0)