Merge pull request #52 from andrewgaul/nuke-empty-bucket

Handle empty bucket while nuking

Reviewed-by: Yehuda Sadeh <yehuda@redhat.com>
This commit is contained in:
Yehuda Sadeh 2015-05-01 13:14:39 -07:00
commit f9ab26c05c

View file

@ -70,7 +70,10 @@ def nuke_prefixed_buckets_on_conn(prefix, name, conn):
try: try:
iterator = iter(bucket.list_versions()) iterator = iter(bucket.list_versions())
# peek into iterator to issue list operation # peek into iterator to issue list operation
try:
keys = itertools.chain([next(iterator)], iterator) keys = itertools.chain([next(iterator)], iterator)
except StopIteration:
keys = [] # empty iterator
except boto.exception.S3ResponseError as e: except boto.exception.S3ResponseError as e:
# some S3 implementations do not support object # some S3 implementations do not support object
# versioning - fall back to listing without versions # versioning - fall back to listing without versions