[RFE] Sub-endpoints of ironic resources should be considered subcontrollers, not fields of the resource

Bug #1640546 reported by Vladyslav Drok on 2016-11-09
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
Ironic
In Progress
Wishlist
Vladyslav Drok

Bug Description

Right now, the following request succeeds:

 curl -i -X GET -H 'X-OpenStack-Ironic-API-Version: latest' -H 'Content-Type: application/json' -H 'X-Auth-Token: ***' http://127.0.0.1:6385/v1/nodes/node-0/driver_info

 HTTP/1.1 200 OK
 X-Openstack-Ironic-Api-Minimum-Version: 1.1
 X-Openstack-Ironic-Api-Maximum-Version: 1.24
 X-Openstack-Ironic-Api-Version: 1.24
 Content-Length: 437
 Content-Type: application/json; charset=UTF-8
 Openstack-Request-Id: req-5685cb9b-d030-42ea-b859-a0d202a6481c
 Date: Wed, 09 Nov 2016 16:59:31 GMT

 {"links": [{"href": "http://127.0.0.1:6385/v1/nodes/10d37852-f656-4f8b-94ae-b93c8921f832", "rel": "self"}, {"href": "http://127.0.0.1:6385/nodes/10d37852-f656-4f8b-94ae-b93c8921f832", "rel": "bookmark"}], "driver_info": {"ipmi_port": 6230, "ipmi_username": "admin", "deploy_kernel": "af919996-91e1-46da-a443-c1a0598d9d11", "ipmi_address": "127.0.0.1", "deploy_ramdisk": "0e362471-4870-4e23-a9ca-d0d4be9abdea", "ipmi_password": "******"}}

Trying to access an invalid field in such way returns 400:

 curl -i -X GET -H 'X-OpenStack-Ironic-API-Version: latest' -H 'Content-Type: application/json' -H 'X-Auth-Token: ***' http://127.0.0.1:6385/v1/nodes/node-0/driver_in
 HTTP/1.1 400 Bad Request
 X-Openstack-Ironic-Api-Minimum-Version: 1.1
 X-Openstack-Ironic-Api-Maximum-Version: 1.24
 X-Openstack-Ironic-Api-Version: 1.24
 Openstack-Request-Id: req-92dc5fa1-c7ba-4199-b50a-c2f12d216309
 Content-Type: application/json
 Content-Length: 132
 Date: Wed, 09 Nov 2016 17:01:46 GMT

 {"error_message": "{\"debuginfo\": null, \"faultcode\": \"Client\", \"faultstring\": \"Field(s) \\\"driver_in\\\" are not valid\"}"}

Being unable to find a subcontroller should or a field in a resource should return error code 404 instead of 400. API microversion will be bumped.

Vladyslav Drok (vdrok) on 2016-11-09
Changed in ironic:
importance: Undecided → Wishlist
assignee: nobody → Vladyslav Drok (vdrok)
tags: added: rfe
Jay Faulkner (jason-oldos) wrote :

We should be sure that if we do change all these response codes in bulk, that we bump the micro version at the same time. Even if we consider it a bug fix, it's too big of a chance to foist onto people without a version boundary.

Vladyslav Drok (vdrok) wrote :

Sure, added a note about that in the description.

description: updated
Ruby Loo (rloo) on 2016-11-28
summary: - Sub-endpoints of ironic resources should be considered subcontrollers,
- not fields of the resource
+ [RFE] Sub-endpoints of ironic resources should be considered
+ subcontrollers, not fields of the resource
Vladyslav Drok (vdrok) on 2016-12-05
tags: removed: rfe
description: updated
Vladyslav Drok (vdrok) on 2016-12-05
tags: added: needs-spec rfe
Ruby Loo (rloo) wrote :

This was discussed in today's ironic meeting [1]. We think it might be worth fixing, but low priority, and it requires a spec.

[1] starting at 17:33:12, http://eavesdrop.openstack.org/meetings/ironic/2016/ironic.2016-12-05-17.01.log.html

Changed in ironic:
status: New → Triaged

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

Changed in ironic:
status: Triaged → In Progress

Change abandoned by Vladyslav Drok (<email address hidden>) on branch: master
Review: https://review.openstack.org/426257

To post a comment you must log in.
This report contains Public information  Edit
Everyone can see this information.

Other bug subscribers