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)

Thanks
Max

__________________________________________________________________________
OpenStack Development Mailing List (not for usage questions)
Unsubscribe: openstack-dev-requ...@lists.openstack.org?subject:unsubscribe
http://lists.openstack.org/cgi-bin/mailman/listinfo/openstack-dev

Reply via email to