forked from TrueCloudLab/s3-tests
Refactor bucket nuking in cleanup.
This commit is contained in:
parent
f30f9d0aca
commit
f58641d0bf
1 changed files with 31 additions and 28 deletions
|
@ -47,12 +47,7 @@ def choose_bucket_prefix(template, max_len=30):
|
|||
),
|
||||
)
|
||||
|
||||
def nuke_prefixed_buckets():
|
||||
for name, conn in s3.items():
|
||||
print 'Cleaning buckets from connection {name}'.format(name=name)
|
||||
for bucket in conn.get_all_buckets():
|
||||
if bucket.name.startswith(prefix):
|
||||
print 'Cleaning bucket {bucket}'.format(bucket=bucket)
|
||||
def nuke_bucket(bucket):
|
||||
try:
|
||||
bucket.set_canned_acl('private')
|
||||
# TODO: deleted_cnt and the while loop is a work around for rgw
|
||||
|
@ -82,6 +77,14 @@ def nuke_prefixed_buckets():
|
|||
# seems like we're not the owner of the bucket; ignore
|
||||
pass
|
||||
|
||||
def nuke_prefixed_buckets():
|
||||
for name, conn in s3.items():
|
||||
print 'Cleaning buckets from connection {name}'.format(name=name)
|
||||
for bucket in conn.get_all_buckets():
|
||||
if bucket.name.startswith(prefix):
|
||||
print 'Cleaning bucket {bucket}'.format(bucket=bucket)
|
||||
nuke_bucket(bucket)
|
||||
|
||||
print 'Done with cleanup of test buckets.'
|
||||
|
||||
def read_config(fp):
|
||||
|
|
Loading…
Reference in a new issue