MCPcopy Index your code
hub / github.com/aws/aws-cli / delete_bucket

Method delete_bucket

tests/__init__.py:602–623  ·  view source on GitHub ↗
(self, bucket_name, attempts=5, delay=5)

Source from the content-addressed store, hash-verified

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)

Callers

nothing calls this directly

Calls 4

remove_all_objectsMethod · 0.95
bucket_not_existsMethod · 0.95
sleepMethod · 0.45

Tested by

no test coverage detected