GET a subresource where parent doesn't exist doesn't return 404

Bug #1246731 reported by Lucas Alvares Gomes
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
Ironic
Fix Released
Medium
Lucas Alvares Gomes

Bug Description

GET /nodes/<id>/ports OR /chassis/<id>/nodes will not fail with a 404 in case the <id> does not exist, I think it should cause we are trying to access a subresource of a resource that doesn't not exist.

On chassis:

$ curl -X GET http://0.0.0.0:6385/v1/chassis/64ec49cf-8881-4ceb-ba9e-cf9d67b63e69/nodes | python -mjson.tool
  % Total % Received % Xferd Average Speed Time Time Time Current
                                 Dload Upload Total Spent Left Speed
100 13 100 13 0 0 1219 0 --:--:-- --:--:-- --:--:-- 1300
{
    "nodes": []
}

$ curl -X GET http://0.0.0.0:6385/v1/chassis/64ec49cf-8881-4ceb-ba9e-cf9d67b63e69 | python -mjson.tool
  % Total % Received % Xferd Average Speed Time Time Time Current
                                 Dload Upload Total Spent Left Speed
100 156 100 156 0 0 3428 0 --:--:-- --:--:-- --:--:-- 3466
{
    "error_message": "{\"debuginfo\": null, \"faultcode\": \"Server\", \"faultstring\": \"Chassis 64ec49cf-8881-4ceb-ba9e-cf9d67b63e69 could not be found.\"}"
}

On nodes:

$ curl -X GET http://0.0.0.0:6385/v1/nodes/5298429b-00b0-4628-8b4d-44d40ac69f58/ports | python -mjson.tool
  % Total % Received % Xferd Average Speed Time Time Time Current
                                 Dload Upload Total Spent Left Speed
100 13 100 13 0 0 1306 0 --:--:-- --:--:-- --:--:-- 1444
{
    "ports": []
}

$ curl -X GET http://0.0.0.0:6385/v1/nodes/5298429b-00b0-4628-8b4d-44d40ac69f58 | python -mjson.tool
  % Total % Received % Xferd Average Speed Time Time Time Current
                                 Dload Upload Total Spent Left Speed
100 153 100 153 0 0 968 0 --:--:-- --:--:-- --:--:-- 974
{
    "error_message": "{\"debuginfo\": null, \"faultcode\": \"Server\", \"faultstring\": \"Node 5298429b-00b0-4628-8b4d-44d40ac69f58 could not be found.\"}"
}

Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix proposed to ironic (master)

Fix proposed to branch: master
Review: https://review.openstack.org/54742

Changed in ironic:
assignee: nobody → Lucas Alvares Gomes (lucasagomes)
status: New → In Progress
aeva black (tenbrae)
Changed in ironic:
importance: Undecided → Medium
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix merged to ironic (master)

Reviewed: https://review.openstack.org/54742
Committed: http://github.com/openstack/ironic/commit/35208610e89195d92ee29ec51f55d318bb7618e9
Submitter: Jenkins
Branch: master

commit 35208610e89195d92ee29ec51f55d318bb7618e9
Author: Lucas Alvares Gomes <email address hidden>
Date: Thu Oct 31 14:13:27 2013 +0000

    Accessing a subresource that parent does not exist

    When accessing a subresource like /nodes/<id>/ports or /chassis/<id>/nodes
    where <id> does not exist should fail with 404.

    Also fix a typo in the name of a method on test_nodes.py

    Change-Id: I5b6beba00fa7cc72b45689c5685914da895b7aa2
    Closes-Bug: #1246731

Changed in ironic:
status: In Progress → Fix Committed
Thierry Carrez (ttx)
Changed in ironic:
milestone: none → icehouse-1
status: Fix Committed → Fix Released
Thierry Carrez (ttx)
Changed in ironic:
milestone: icehouse-1 → 2014.1
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.