(self, bucket_name, attempts=5, delay=5)
| 600 | return response |
| 601 | |
| 602 | def delete_bucket(self, bucket_name, attempts=5, delay=5): |
| 603 | self.remove_all_objects(bucket_name) |
| 604 | client = self._create_client_for_bucket(bucket_name) |
| 605 | |
| 606 | # There's a chance that, even though the bucket has been used |
| 607 | # several times, the delete will fail due to eventual consistency |
| 608 | # issues. |
| 609 | attempts_remaining = attempts |
| 610 | while True: |
| 611 | attempts_remaining -= 1 |
| 612 | try: |
| 613 | client.delete_bucket(Bucket=bucket_name) |
| 614 | break |
| 615 | except client.exceptions.NoSuchBucket: |
| 616 | if self.bucket_not_exists(bucket_name): |
| 617 | # Fast fail when the NoSuchBucket error is real. |
| 618 | break |
| 619 | if attempts_remaining <= 0: |
| 620 | raise |
| 621 | time.sleep(delay) |
| 622 | |
| 623 | self._bucket_to_region.pop(bucket_name, None) |
| 624 | |
| 625 | def remove_all_objects(self, bucket_name): |
| 626 | client = self._create_client_for_bucket(bucket_name) |
nothing calls this directly
no test coverage detected