Skip to content

Commit

Permalink
[sos] Set a User Agent for s3 based uploads
Browse files Browse the repository at this point in the history
Resolves: #3688

Signed-off-by: Trevor Benson <[email protected]>
  • Loading branch information
TrevorBenson authored and arif-ali committed Nov 18, 2024
1 parent 25f5e26 commit 27e0e75
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion sos/policies/distros/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@

try:
import boto3
from botocore.config import Config as BotocoreConfig
BOTO3_LOADED = True
except ImportError:
BOTO3_LOADED = False
Expand Down Expand Up @@ -997,10 +998,13 @@ def upload_s3(self, endpoint=None, region=None, bucket=None, prefix=None,
if not secret_key:
secret_key = self.get_upload_s3_secret_key()

boto3_config = BotocoreConfig(user_agent_extra='app/sos')

s3_client = boto3.client('s3', endpoint_url=endpoint,
region_name=region,
aws_access_key_id=access_key,
aws_secret_access_key=secret_key)
aws_secret_access_key=secret_key,
config=boto3_config)

try:
key = prefix + self.upload_archive_name.split('/')[-1]
Expand Down

0 comments on commit 27e0e75

Please sign in to comment.