Comment 0 for bug 1507988

Revision history for this message
Venkata Mahesh Jonnalagadda (vj884x) wrote : zaqar should return 204 http response code for existing pool name while creating again

I created a pool with name "wat" as below -

stack@qaas-02:~/zaqar$ curl -i -X PUT http://localhost:8888/v1.1/pools/wat -d '{"weight": 100, "uri": "mongodb://127.0.0.1:27017", "options": {"max_retry_sleep": 1}}' -H "Content-type: application/json" -H "Client-ID: 318e462e-598e-4840-a6a5-9ea96f082933" -H "X-Auth-Token: $TOKENID"
HTTP/1.0 201 Created
Date: Mon, 19 Oct 2015 13:41:27 GMT
Server: WSGIServer/0.1 Python/2.7.6
content-length: 0
location: /v1.1/pools/wat
stack@qaas-02:~/zaqar$

When I rerun the above curl command again with same pool name, it gives HTTP Response Code "201 Created", which is wrong! It shouldn't do this! and It is updating the pool again!

Whenever zaqar finds a pool name with existing pool, it has to respond user with HTTP Response Code - "409"

# 409 Conflict
Details: Indicates that the request could not be processed because of conflict in the request, such as an edit conflict in the case of multiple updates.

When user gets "409 Conflict" response code then it is meant to try with different pool name.