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 committed Oct 25, 2024
1 parent 1d2e27e commit 4352c29
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 @@ -996,11 +997,14 @@ 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 4352c29

Please sign in to comment.