ceilometer event list api should prompt valid values when query operator is invalid

Bug #1407378 reported by ZhiQiang Fan
8
This bug affects 1 person
Affects Status Importance Assigned to Milestone
Ceilometer
Fix Released
Low
shubham chitranshi

Bug Description

curl -i -X GET -H 'X-Auth-Token: 8065419986684ee89d465f7cd81e8579' -H 'Content-Type: application/json' -H 'Accept: application/json' -H 'User-Agent: python-ceilometerclient' 'http://172.128.231.201:8777/v2/events?q.field=instance_type_id&q.op=eq&q.type=xyz&q.value=6'
HTTP/1.0 400 Bad Request
Date: Sat, 03 Jan 2015 19:58:20 GMT
Server: WSGIServer/0.1 Python/2.7.6
Content-Type: application/json
Content-Length: 191

{"error_message": {"debuginfo": null, "faultcode": "Client", "faultstring": "The data type xyz is not supported. The supported data type list is: ['integer', 'float', 'string', 'datetime']"}}

when trait type is invalid, the message is good

but

curl -i -X GET -H 'X-Auth-Token: 8065419986684ee89d465f7cd81e8579' -H 'Content-Type: application/json' -H 'Accept: application/json' -H 'User-Agent: python-ceilometerclient' 'http://172.128.231.201:8777/v2/events?q.field=instance_type_id&q.op=xyz&q.type=integer&q.value=6'
HTTP/1.0 400 Bad Request
Date: Sat, 03 Jan 2015 19:52:46 GMT
Server: WSGIServer/0.1 Python/2.7.6
Content-Type: application/json
Content-Length: 105

{"error_message": {"debuginfo": null, "faultcode": "Client", "faultstring": "operator xyz is incorrect"}}

when operator is invalid, the message is not so good

ZhiQiang Fan (aji-zqfan)
Changed in ceilometer:
assignee: nobody → ZhiQiang Fan (aji-zqfan)
gordon chung (chungg)
Changed in ceilometer:
status: New → Triaged
importance: Undecided → Low
Revision history for this message
shubham chitranshi (chitranshi-shubham) wrote :

is this a bug for python-ceilometerclient ?

Changed in ceilometer:
status: Triaged → Confirmed
assignee: ZhiQiang Fan (aji-zqfan) → shubham chitranshi (chitranshi-shubham)
Changed in ceilometer:
status: Confirmed → In Progress
Revision history for this message
shubham chitranshi (chitranshi-shubham) wrote :

Submitted the path for this bug..
Please review

https://review.openstack.org/#/c/196535/

Revision history for this message
shubham chitranshi (chitranshi-shubham) wrote :

Hey I am trying to write the test case for this bug fix, as pointed out by liusheng. can you give me a heads up on where to start from ??
My guess is https://github.com/openstack/ceilometer/blob/master/ceilometer/tests/event/test_converter.py
But I am not sure yet..!

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

Reviewed: https://review.openstack.org/196535
Committed: https://git.openstack.org/cgit/openstack/ceilometer/commit/?id=5c02084336cfead49638cb3208d791fc74891674
Submitter: Jenkins
Branch: master

commit 5c02084336cfead49638cb3208d791fc74891674
Author: Shubham Chitranshi <email address hidden>
Date: Mon Jun 29 10:17:45 2015 +0530

    Added valid values of operator to response body

    when an event query is requested with invalid operator as query parameter,
    the response will contain valid list of operator as suggestion.

    Closes-Bug: #1407378

    Change-Id: I82ed0b8b61ed5bf297efe890cee10000f5ffb7a8

Changed in ceilometer:
status: In Progress → Fix Committed
Thierry Carrez (ttx)
Changed in ceilometer:
milestone: none → liberty-2
status: Fix Committed → Fix Released
Thierry Carrez (ttx)
Changed in ceilometer:
milestone: liberty-2 → 5.0.0
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.