Forráskód Böngészése

HUE-8364 [s3] Fix s3 not getting initialized in certain scenarios

jdesjean 7 éve
szülő
commit
45319554ce
2 módosított fájl, 23 hozzáadás és 7 törlés
  1. 21 5
      desktop/libs/aws/src/aws/conf.py
  2. 2 2
      desktop/libs/aws/src/aws/s3/s3fs.py

+ 21 - 5
desktop/libs/aws/src/aws/conf.py

@@ -40,9 +40,25 @@ AWS_ACCOUNT_REGION_DEFAULT = 'us-east-1' # Location.USEast
 
 
 def get_locations():
-  return (Location.EU, Location.EUCentral1, Location.EUWest, Location.EUWest2, Location.CACentral, Location.USEast,
-          Location.USEast2, Location.USWest, Location.USWest2, Location.SAEast, Location.APNortheast,
-          Location.APNortheast2, Location.APSoutheast, Location.APSoutheast2, Location.APSouth, Location.CNNorth1)
+  return ('EU',  # Ireland
+    'eu-central-1',  # Frankfurt
+    'eu-west-1',
+    'eu-west-2',
+    'eu-west-3',
+    'ca-central-1',
+    'us-east-1',
+    'us-east-2',
+    'us-west-1',
+    'us-west-2',
+    'sa-east-1',
+    'ap-northeast-1',
+    'ap-northeast-2',
+    'ap-northeast-3',
+    'ap-southeast-1',
+    'ap-southeast-2',
+    'ap-south-1',
+    'cn-north-1',
+    'cn-northwest-1')
 
 
 def get_default_access_key_id():
@@ -62,7 +78,7 @@ def get_default_secret_key():
 
 
 def get_default_region():
-  region = Location.DEFAULT
+  region = ''
 
   if 'default' in AWS_ACCOUNTS:
     # First check the host/endpoint configuration
@@ -80,7 +96,7 @@ def get_default_region():
     # If the parsed out region is not in the list of supported regions, fallback to the default
     if region not in get_locations():
       LOG.warn("Region, %s, not found in the list of supported regions: %s" % (region, ', '.join(get_locations())))
-      region = Location.DEFAULT
+      region = ''
 
   return region
 

+ 2 - 2
desktop/libs/aws/src/aws/s3/s3fs.py

@@ -106,8 +106,8 @@ class S3FileSystem(object):
     # We change location to default to fix issue
     # More information: https://github.com/boto/boto3/issues/125
 
-    if kwargs.get('location') == Location.USEast:
-      kwargs['location'] = Location.DEFAULT
+    if kwargs.get('location') == 'us-east-1':
+      kwargs['location'] = ''
 
     return self._s3_connection.create_bucket(name, **kwargs)