Handle empty bucket while nuking

Signed-off-by: Andrew Gaul <andrew@gaul.org>
This commit is contained in:
Andrew Gaul 2015-05-01 13:09:51 -07:00
parent e4dafa0cc2
commit 31efb46b28

View file

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