From 4352c29a32b2a64941f17fd5024727fac9f0c8dd Mon Sep 17 00:00:00 2001 From: Trevor Benson Date: Fri, 25 Oct 2024 16:16:49 -0700 Subject: [PATCH] [sos] Set a User Agent for s3 based uploads Resolves: #3688 Signed-off-by: Trevor Benson --- sos/policies/distros/__init__.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/sos/policies/distros/__init__.py b/sos/policies/distros/__init__.py index 8c178020ec..9edee834c4 100644 --- a/sos/policies/distros/__init__.py +++ b/sos/policies/distros/__init__.py @@ -36,6 +36,7 @@ try: import boto3 + from botocore.config import Config as BotocoreConfig BOTO3_LOADED = True except ImportError: BOTO3_LOADED = False @@ -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]