tsuru service exception

15 views
Skip to first unread message

Vicente Malaga

unread,
Sep 9, 2015, 11:39:16 AM9/9/15
to tsuru
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

Francisco Souza

unread,
Sep 9, 2015, 6:57:57 PM9/9/15
to tsuru...@googlegroups.com
Hi Vicente,
This is definitely a bug in tsuru :-( It should ot remove the service
instance when the remote API fails to remove it.

Can you open an issue in our GitHub repository?

Thanks,
Francisco
> --
> You received this message because you are subscribed to the Google Groups
> "tsuru" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to tsuru-users...@googlegroups.com.
> For more options, visit https://groups.google.com/d/optout.

Reply all
Reply to author
Forward
0 new messages