DELETE /servers returns 404 when it should return 405

Bug #1567970 reported by Chris Dent
8
This bug affects 1 person
Affects Status Importance Assigned to Milestone
OpenStack Compute (nova)
Confirmed
Low
Unassigned

Bug Description

(Master devstack, master nova, April 8, 2016)

curl -v -H 'x-auth-token: e893759204ff41d49542b9d87520b03a' -X DELETE http://192.168.33.10:8774/v2.1/servers

returns an HTTP status code of 404. It should be 405: <https://httpstatuses.com/405>

This is because /servers is in fact a valid URL, you can call at least GET and POST on it.

gabbi version:

- name: try bad method
  desc:
  xfail: True
  DELETE: /servers
  status: 405

Tags: api gabbi
Changed in nova:
status: New → Confirmed
importance: Undecided → Low
Chris Dent (cdent)
tags: added: gabbi
Changed in nova:
assignee: nobody → Gregory Hooks (gregoryhooksjr)
Revision history for this message
Gregory Hooks (gregoryhooksjr) wrote :

I have been able to re-produce this bug. It appears that any HTTP method other than GET or POST will return a status code of 404. I am currently in the process of finding out why other HTTP methods are not being properly handled.

Revision history for this message
Markus Zoeller (markus_z) (mzoeller) wrote :

Solving an inconsistency: This bug report has an assignee and it looks
like this will result in a patch. Therefore I switch the status to
"In Progress".
Dear assignee, please provide a patch in the next 2 weeks. If you stop
working on this report, please remove yourself as assignee and switch
the status back. If you need assistance, reach out on the IRC channel
#openstack-nova or use the mailing list.

Changed in nova:
status: Confirmed → In Progress
Revision history for this message
Chris Dent (cdent) wrote :

Discussion with the Nova API subteam indicates that fixing this will likely require a spec as it will change a 4xx response code across a broad swath of requests.

The 404 should be a 405 situation is likely present anywhere the Routes library is being used for request dispatch.

Changed in nova:
status: In Progress → Confirmed
assignee: Gregory Hooks (gregoryhooksjr) → nobody
Revision history for this message
Chris Dent (cdent) wrote :

I've done some digging in the Routes package <http://routes.readthedocs.org/en/latest/index.html> to see what would need to happen to address this, and it is challenging.

Routes itself can do conditionals: it will match on limited methods. However, as far as I can tell, when there is no match it simply returns None, no evidence that some other method would match.

May not be worth fixing in this iteration of Nova. :(

stgleb (gstepanov)
Changed in nova:
assignee: nobody → stgleb (gstepanov)
status: Confirmed → In Progress
Revision history for this message
Chris Dent (cdent) wrote :

A while back I did two things related to this:

* made a bug in routes: https://github.com/bbangert/routes/issues/70
* hacked in support for Routes + 405 handling in the placement API: https://github.com/openstack/nova/blob/master/nova/api/openstack/placement/handler.py#L116

There might be something that can be borrowed from the latter.

Revision history for this message
Sean Dague (sdague) wrote :

There are no currently open reviews on this bug, changing
the status back to the previous state and unassigning. If
there are active reviews related to this bug, please include
links in comments.

Changed in nova:
status: In Progress → Confirmed
assignee: stgleb (gstepanov) → nobody
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.