mirror of
https://github.com/ceph/s3-tests.git
synced 2024-11-21 11:51:06 +00:00
nuke_prefixed_buckets() ignores 404 from bucket delete
if a bucket delete request times out, the retry will likely get a 404 NoSuchBucket response. ignore that error and treat this as a success Signed-off-by: Casey Bodley <cbodley@redhat.com>
This commit is contained in:
parent
16393fb667
commit
28b793271f
2 changed files with 15 additions and 2 deletions
|
@ -91,7 +91,13 @@ def nuke_prefixed_buckets_on_conn(prefix, name, conn):
|
|||
))
|
||||
# key.set_canned_acl('private')
|
||||
bucket.delete_key(key.name, version_id = key.version_id)
|
||||
bucket.delete()
|
||||
try:
|
||||
bucket.delete()
|
||||
except boto.exception.S3ResponseError as e:
|
||||
# if DELETE times out, the retry may see NoSuchBucket
|
||||
if e.error_code != 'NoSuchBucket':
|
||||
raise e
|
||||
pass
|
||||
success = True
|
||||
except boto.exception.S3ResponseError as e:
|
||||
if e.error_code != 'AccessDenied':
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
import boto3
|
||||
from botocore import UNSIGNED
|
||||
from botocore.client import Config
|
||||
from botocore.exceptions import ClientError
|
||||
from botocore.handlers import disable_signing
|
||||
import ConfigParser
|
||||
import os
|
||||
|
@ -123,7 +124,13 @@ def nuke_prefixed_buckets(prefix, client=None):
|
|||
delete_markers = get_delete_markers_list(bucket_name, client)
|
||||
for obj in delete_markers:
|
||||
response = client.delete_object(Bucket=bucket_name,Key=obj[0],VersionId=obj[1])
|
||||
client.delete_bucket(Bucket=bucket_name)
|
||||
try:
|
||||
client.delete_bucket(Bucket=bucket_name)
|
||||
except ClientError, e:
|
||||
# if DELETE times out, the retry may see NoSuchBucket
|
||||
if e.response['Error']['Code'] != 'NoSuchBucket':
|
||||
raise e
|
||||
pass
|
||||
|
||||
print('Done with cleanup of buckets in tests.')
|
||||
|
||||
|
|
Loading…
Reference in a new issue