Skip to content

Commit

Permalink
fix tagging
Browse files Browse the repository at this point in the history
  • Loading branch information
FxKu committed Sep 5, 2024
1 parent c832000 commit 0766812
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions postgres-appliance/scripts/upload_pg_log_to_s3.py
Original file line number Diff line number Diff line change
Expand Up @@ -64,13 +64,13 @@ def upload_to_s3(local_file_path):
chunk_size = 52428800 # 50 MiB
config = TransferConfig(multipart_threshold=chunk_size, multipart_chunksize=chunk_size)
tags = {
'LogEndpoint': os.getenv('LOG_S3_ENDPOINT'),
'Namespace': os.getenv('POD_NAMESPACE'),
'ClusterName': os.getenv('SCOPE')
}
tags_str = "&".join(f"{key}={value}" for key, value in tags.items())

try:
bucket.upload_file(local_file_path, key_name, Config=config, ExtraArgs=tags)
bucket.upload_file(local_file_path, key_name, Config=config, ExtraArgs={'Tagging': tags_str})
except S3UploadFailedError as e:
logger.exception('Failed to upload the %s to the bucket %s under the key %s. Exception: %r',
local_file_path, bucket_name, key_name, e)
Expand Down

0 comments on commit 0766812

Please sign in to comment.