예제 #1
0
 def delete_bucket(self, bucket_id, **kwargs):
     try:
         self.swift.delete_container(bucket_id)
     except swiftclient.ClientException as err:
         if err.http_status == 404:
             return
         if err.http_status == 409:
             raise errors.DriverNonEmptyBucketError(err.args[0])
예제 #2
0
    def delete_bucket(self, bucket_id, clean_multipart=True, **kwargs):
        bucket = self._get_bucket(bucket_id)
        if clean_multipart:
            self.clean_multipart(bucket_id)

        try:
            bucket.delete_bucket()
        except oss2.exceptions.BucketNotEmpty as err:
            raise errors.DriverNonEmptyBucketError(err)
예제 #3
0
 def delete_bucket(self, bucket_id, **kwargs):
     try:
         self.client.delete_bucket(
             namespace_name=self.kwargs['namespace'],
             bucket_name=bucket_id,
         )
     except oci.exceptions.ServiceError as err:
         if err.code == 'BucketNotEmpty':
             raise errors.DriverNonEmptyBucketError(err)
         elif err.code == 'BucketNotFound':
             return
         raise
예제 #4
0
 def delete_bucket(self, bucket_id, **kwargs):
     bucket = self.s3.Bucket(bucket_id)
     try:
         bucket.delete()
     except botocore.exceptions.ClientError as err:
         code = err.response['Error']['Code']
         msg = err.response['Error']['Message']
         if code == 'NoSuchBucket':
             self.logger.debug(err)
             return
         if code == 'BucketNotEmpty':
             raise errors.DriverNonEmptyBucketError(msg)
         raise
예제 #5
0
    def delete_bucket(self, bucket_id, **kwargs):
        bucket = self._get_bucket(bucket_id)
        try:
            unfinisheds = bucket.list_unfinished_large_files()
        except exception.NonExistentBucket:
            return
        for unfinished in unfinisheds:
            bucket.cancel_large_file(unfinished.file_id)

        try:
            self.client.delete_bucket(bucket)
        except exception.BadRequest as err:
            if err.code == 'cannot_delete_non_empty_bucket':
                raise errors.DriverNonEmptyBucketError(err.message)
            raise