zaqar should return appropriate http response code for existing pool name scenario

Bug #1507988 reported by Venkata Mahesh Jonnalagadda on 2015-10-20
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
zaqar
Undecided
Unassigned

Bug Description

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.

2xx series are for Success

It would be nice to use appropriate http status code for this type of scenarios.

summary: - zaqar should return 204 http response code for existing pool name while
+ zaqar should return 409 http response code for existing pool name while
creating again
summary: - zaqar should return 409 http response code for existing pool name while
- creating again
+ zaqar should return 409 http response code for existing pool name
description: updated
summary: - zaqar should return 409 http response code for existing pool name
+ zaqar should return appropriate http response code for existing pool
+ name scenario
To post a comment you must log in.
This report contains Public information  Edit
Everyone can see this information.

Other bug subscribers