[openstack-dev] [Ironic] python-ironicclient weird behaviour

Maxime Belanger mbelanger at internap.com
Thu Dec 22 14:32:06 UTC 2016

Hi Ironic folks,

Yesterday I come across a weird behaviour in python-ironicclient. I discussed briefly with the problem with Julia and befor creating a bug I would like your opinion on the problem and potential fix.

When doing nodes.get(resource_id=None), I get back a Node object set with attribute nodes={nodes: [{uuid: 'blah'}, {uuid: 'bleh'}]}. I guess that is not expected which is the bug I found and I know where to fix it if we agree to not change the behavour: If resource_id=None the client is doing a GET on /v1/nodes which is expected here : https://github.com/openstack/python-ironicclient/blob/1.8.0/ironicclient/common/base.py#L55.

The thing is, returning the first item of the list while doing a get on something that doesn't exists is a bit strange. I do not want to do extra validation on my application side to not pass None to the ironicclient. I would it to behave correctly: 404 or a even a 400.

What do you think/or prefer?

A. Fixing the bug and not changing actual behaviour of the API

B. Changing the API behaviour and returning a 404 error since resource None is not found

C. Changing the API behaviour and returning a 400 error because None is not a valid request. The will be identical to the command line that is doing this:

ironic node-show None
Invalid input for field/attribute node_ident. Value: 'None'. unable to convert to uuid_or_name (HTTP 400)


-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.openstack.org/pipermail/openstack-dev/attachments/20161222/6b0cb522/attachment.html>

More information about the OpenStack-dev mailing list