Hello.
I am working on a S3 compatible service api and have a problem with the remove_instance function.
With the boto library if you try to delete one bucket, but the bucket have any object on it, the boto library return an S3ResponseError 409 with and xml with the reason
S3ResponseError: S3ResponseError: 409 Conflict
<?xml version="1.0" encoding="UTF-8"?><Error><Code>BucketNotEmpty</Code><Message>The bucket you tried to delete is not empty.</Message><Resource>/testbk01</Resource><RequestId></RequestId></Error>
So if I try to use the exception on the api to abort the deletion of the bucket, nothing happend and tsuru allways get a 200, it remove the service instance but don't remove the bucket, so this bucket is not controlled by tsuru anymore
the code:
@app.route("/resources/<name>", methods=["DELETE"])
@auth.required
def remove_instance(name):
conn = boto.connect_s3(
aws_access_key_id = AWS_ACCESS_KEY_ID,
aws_secret_access_key = AWS_SECRET_ACCESS_KEY,
host = AWS_HOST,
is_secure=False,
calling_format = OrdinaryCallingFormat(),
)
if conn.lookup(name) is None:
return 'Bucket name %s not exits' % name , 404
log('A')
try:
conn.delete_bucket(name)
except S3ResponseError, e:
return "Error: %s" % e, 500
return "", 200
Any one can help me ?
Best regards