[cloud] Handle client-error exceptions in s3_bucket (#26044)
* Handle exception when capital letter used in S3 bucket name. * Fix whitespace for PEP8
This commit is contained in:
parent
9a3f5bf1fc
commit
11b1ad0928
1 changed files with 3 additions and 3 deletions
|
@ -129,7 +129,7 @@ try:
|
|||
import boto.ec2
|
||||
from boto.s3.connection import OrdinaryCallingFormat, Location, S3Connection
|
||||
from boto.s3.tagging import Tags, TagSet
|
||||
from boto.exception import BotoServerError, S3CreateError, S3ResponseError
|
||||
from boto.exception import BotoServerError, S3CreateError, S3ResponseError, BotoClientError
|
||||
HAS_BOTO = True
|
||||
except ImportError:
|
||||
HAS_BOTO = False
|
||||
|
@ -255,7 +255,7 @@ def _create_or_update_bucket(connection, module, location):
|
|||
try:
|
||||
bucket = connection.create_bucket(name, location=location)
|
||||
changed = True
|
||||
except S3CreateError as e:
|
||||
except (S3CreateError, BotoClientError) as e:
|
||||
module.fail_json(msg=e.message)
|
||||
|
||||
# Versioning
|
||||
|
@ -390,7 +390,7 @@ def _create_or_update_bucket_ceph(connection, module, location):
|
|||
try:
|
||||
bucket = connection.create_bucket(name, location=location)
|
||||
changed = True
|
||||
except S3CreateError as e:
|
||||
except (S3CreateError, BotoClientError) as e:
|
||||
module.fail_json(msg=e.message)
|
||||
|
||||
if bucket:
|
||||
|
|
Loading…
Reference in a new issue