Explorar o código

HUE-6694 [aws] Gracefully handle bucket creation error for non-DNS compliant names

Jenny Kim %!s(int64=8) %!d(string=hai) anos
pai
achega
5bb5794e7c
Modificáronse 1 ficheiros con 3 adicións e 1 borrados
  1. 3 1
      desktop/libs/aws/src/aws/s3/s3fs.py

+ 3 - 1
desktop/libs/aws/src/aws/s3/s3fs.py

@@ -23,7 +23,7 @@ import posixpath
 import re
 import time
 
-from boto.exception import S3ResponseError
+from boto.exception import BotoClientError, S3ResponseError
 from boto.s3.connection import Location
 from boto.s3.key import Key
 from boto.s3.prefix import Prefix
@@ -100,6 +100,8 @@ class S3FileSystem(object):
   def _get_or_create_bucket(self, name):
     try:
       bucket = self._get_bucket(name)
+    except BotoClientError, e:
+      raise S3FileSystemException(_('Failed to create bucket named "%s": %s') % (name, e.reason))
     except S3ResponseError, e:
       if e.status == 403 or e.status == 301:
         raise S3FileSystemException(_('User is not authorized to access bucket named "%s". '