Command line doesn't print useful message when there are no sample events

Bug #1111972 reported by Dan Florea
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
python-ceilometerclient
Fix Released
Low
Dan Florea

Bug Description

Below is the output:

$ ceilometer sample-list
INFO Starting new HTTP connection (1): 127.0.0.1
'events' <<<<<

A useful error or nothing should be printed.

Dan Florea (dflorea)
Changed in ceilometer:
assignee: nobody → Dan Florea (dflorea)
Revision history for this message
Doug Hellmann (doug-hellmann) wrote :

I'm not sure it's really an error to have an empty result set from a query, is it?

Revision history for this message
Dan Florea (dflorea) wrote :

I updated the bug description. The CLI prints 'events' which doesn't mean much to the user. It should either print nothing (empty result) as you mentioned or a useful error message. I also found that subcommand options are not working properly.

description: updated
Revision history for this message
Dan Florea (dflorea) wrote :

I take that back. Subcommand options are fine. But 'events' is printed as a result of a KeyError exception that isn't handled.

description: updated
Dan Florea (dflorea)
Changed in ceilometer:
status: New → In Progress
Revision history for this message
Lianhao Lu (lianhao-lu) wrote :

@dflorea, I think your patch https://review.openstack.org/21687 is still valid and useful to us. Do you have time to restore that patch and add unit test for it, so we can get it merged in rc-1? If you don't have time, you can assign this bug to me.

Julien Danjou (jdanjou)
affects: ceilometer → python-ceilometerclient
Revision history for this message
Dan Florea (dflorea) wrote :

I can put in my patch, but I found that the bug no longer occurs because of other changes that have gone in. I thought we could close this bug and abandon the patch. If you think it's still useful to add my patch, I can certainly do that along with a unit test for it. Just let me know.

Revision history for this message
Lianhao Lu (lianhao-lu) wrote :

I did a little debug, it seems to me that KeyError exception is still there, so I think your patch is still useful.

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

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

Revision history for this message
Dan Florea (dflorea) wrote :

I just resubmitted my patch along with the needed unit test: https://review.openstack.org/23965.

Revision history for this message
Doug Hellmann (doug-hellmann) wrote :

Dan, is the URL for that patch correct? I get a permission error when I click the link.

Revision history for this message
Dan Florea (dflorea) wrote :

Something strange is going on. If I'm logged in to review.openstack.org I can access the link. You can also see the same link from hudson-openstack above in the comments. I'm not sure why this is happening. I also don't see anything from Jenkins in the review, which makes me think that I messed up something.

Revision history for this message
Dan Florea (dflorea) wrote :

Ok. I figured it out. The link should work now.

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

Reviewed: https://review.openstack.org/23965
Committed: http://github.com/openstack/python-ceilometerclient/commit/2b5fcd60c4b5ca37e347657879a28af011729dbd
Submitter: Jenkins
Branch: master

commit 2b5fcd60c4b5ca37e347657879a28af011729dbd
Author: Dan Florea <email address hidden>
Date: Fri Mar 8 14:15:54 2013 -0800

    Catch KeyError exception as early as possible when there is no matching data on the server.

    When the server does not have any data matching the requested response_key, it can still return
    successfully. A subsequent lookup in the returned data throws a KeyError exception. The simple
    fix for this is to catch the KeyError exception and return an empty list. An empty list, rather
    than None, is required because the calling code expects an iterable. The exception is caught
    as early as possible after the server returns from the GET request. The end result is that the
    CLI user sees an empty result when the requested data doesn't exist on the server. Prior to
    this fix the keyError exception was propagated all the way to the user, causing a confusing
    message to be printed. Also added associated unit test.

    Fixes bug #1111972

    Change-Id: I88ba658f8be7e7edf255ef9f7d83ba87f36f4efc

Changed in python-ceilometerclient:
status: In Progress → Fix Committed
gordon chung (chungg)
Changed in python-ceilometerclient:
importance: Undecided → Low
Changed in python-ceilometerclient:
milestone: none → 1.3.0
status: Fix Committed → Fix Released
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.