fix nuke_buckets for non-region tests

Signed-off-by: Joe Buck <jbbuck@gmail.com>
This commit is contained in:
Joe Buck 2013-08-30 23:38:04 -07:00
parent 2a216abcb4
commit ad9f3615e3

View file

@ -77,23 +77,27 @@ def nuke_prefixed_buckets_on_conn(prefix, name, conn):
pass pass
def nuke_prefixed_buckets(prefix): def nuke_prefixed_buckets(prefix):
# First, delete all buckets on the master connection # If no regions are specified, use the simple method
for name, conn in s3.items(): if targets.main.master == None:
#if conn == s3[targets.main.master]: for name, conn in s3.items():
if conn == targets.main.master.connection: print 'Deleting buckets on {name}'.format(name=name)
print 'Deleting buckets on {name} (master)'.format(name=name)
nuke_prefixed_buckets_on_conn(prefix, name, conn)
# Then sync to propagate deletes to secondaries
region_sync_meta(targets.main, targets.main.master.connection)
print 'region-sync in nuke_prefixed_buckets'
# Now delete remaining buckets on any other connection
for name, conn in s3.items():
#if conn != s3[targets.main.master]:
if conn != targets.main.master.connection:
print 'Deleting buckets on {name} (non-master)'.format(name=name)
nuke_prefixed_buckets_on_conn(prefix, name, conn) nuke_prefixed_buckets_on_conn(prefix, name, conn)
else:
# First, delete all buckets on the master connection
for name, conn in s3.items():
if conn == targets.main.master.connection:
print 'Deleting buckets on {name} (master)'.format(name=name)
nuke_prefixed_buckets_on_conn(prefix, name, conn)
# Then sync to propagate deletes to secondaries
region_sync_meta(targets.main, targets.main.master.connection)
print 'region-sync in nuke_prefixed_buckets'
# Now delete remaining buckets on any other connection
for name, conn in s3.items():
if conn != targets.main.master.connection:
print 'Deleting buckets on {name} (non-master)'.format(name=name)
nuke_prefixed_buckets_on_conn(prefix, name, conn)
print 'Done with cleanup of test buckets.' print 'Done with cleanup of test buckets.'