Browse Source

HUE-9435 [aws] Fix issue with aws behind proxy and make S3_USE_SIGV4 default when region is set

Mahesh Balakrishnan 5 years ago
parent
commit
4e10db173b
1 changed files with 3 additions and 5 deletions
  1. 3 5
      desktop/libs/aws/src/aws/client.py

+ 3 - 5
desktop/libs/aws/src/aws/client.py

@@ -160,16 +160,14 @@ class Client(object):
 
 
     # Attempt to create S3 connection based on configured credentials and host or region first, then fallback to IAM
     # Attempt to create S3 connection based on configured credentials and host or region first, then fallback to IAM
     try:
     try:
+      # Use V4 signature support by default
+      os.environ['S3_USE_SIGV4'] = 'True'
       if self._host is not None:
       if self._host is not None:
-        # Use V4 signature support by default
-        os.environ['S3_USE_SIGV4'] = 'True'
         kwargs.update({'host': self._host})
         kwargs.update({'host': self._host})
         connection = boto.s3.connection.S3Connection(**kwargs)
         connection = boto.s3.connection.S3Connection(**kwargs)
       elif self._region:
       elif self._region:
         connection = boto.s3.connect_to_region(self._region,
         connection = boto.s3.connect_to_region(self._region,
-                                             aws_access_key_id=self._access_key_id,
-                                             aws_secret_access_key=self._secret_access_key,
-                                             security_token=self._security_token)
+                                             **kwargs)
       else:
       else:
         kwargs.update({'host': 's3.amazonaws.com'})
         kwargs.update({'host': 's3.amazonaws.com'})
         connection = boto.s3.connection.S3Connection(**kwargs)
         connection = boto.s3.connection.S3Connection(**kwargs)