From 31efb46b285adc66e36efa5986d9bbe5334b04d0 Mon Sep 17 00:00:00 2001 From: Andrew Gaul Date: Fri, 1 May 2015 13:09:51 -0700 Subject: [PATCH] Handle empty bucket while nuking Signed-off-by: Andrew Gaul --- s3tests/functional/__init__.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/s3tests/functional/__init__.py b/s3tests/functional/__init__.py index 9681099..68f27bd 100644 --- a/s3tests/functional/__init__.py +++ b/s3tests/functional/__init__.py @@ -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 - keys = itertools.chain([next(iterator)], iterator) + 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