Skip to content

Commit

Permalink
platform(general): improve upload failure logging and log size of fai…
Browse files Browse the repository at this point in the history
…led files (#6076)

* improve upload failure logging and log size of failed files

* remove debugging test
  • Loading branch information
mikeurbanski1 authored Mar 8, 2024
1 parent 77f6668 commit a281ada
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 3 deletions.
5 changes: 3 additions & 2 deletions checkov/common/bridgecrew/platform_integration.py
Original file line number Diff line number Diff line change
Expand Up @@ -902,11 +902,12 @@ def _persist_file(self, full_file_path: str, s3_file_key: str) -> None:
sleep(SLEEP_SECONDS)
curr_try += 1
else:
logging.error(f"failed to persist file {full_file_path} into S3 bucket {self.bucket}",
exc_info=True)
logging.error(f"failed to persist file {full_file_path} into S3 bucket {self.bucket}", exc_info=True)
logging.debug(f"file size of {full_file_path} is {os.stat(full_file_path).st_size} bytes")
raise
except Exception:
logging.error(f"failed to persist file {full_file_path} into S3 bucket {self.bucket}", exc_info=True)
logging.debug(f"file size of {full_file_path} is {os.stat(full_file_path).st_size} bytes")
raise
if curr_try == tries:
logging.error(
Expand Down
2 changes: 1 addition & 1 deletion checkov/common/bridgecrew/wrapper.py
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ def _put_json_object(s3_client: S3Client, json_obj: Any, bucket: str, object_pat
try:
s3_client.put_object(Bucket=bucket, Key=object_path, Body=json.dumps(json_obj, cls=CustomJSONEncoder))
except Exception:
logging.error(f"failed to persist object into S3 bucket {bucket}", exc_info=log_stack_trace_on_error)
logging.error(f"failed to persist object into S3 bucket {bucket} - {object_path}", exc_info=log_stack_trace_on_error)
raise


Expand Down

0 comments on commit a281ada

Please sign in to comment.