forked from TrueCloudLab/s3-tests
Handle empty bucket while nuking
Signed-off-by: Andrew Gaul <andrew@gaul.org>
This commit is contained in:
parent
e4dafa0cc2
commit
31efb46b28
1 changed files with 4 additions and 1 deletions
|
@ -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
|
||||||
keys = itertools.chain([next(iterator)], iterator)
|
try:
|
||||||
|
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
|
||||||
|
|
Loading…
Reference in a new issue