Image NotFound and NoUniqueMatch raises same CommandError in openstackclient part

Bug #1480156 reported by Marek Aufart
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
Glance
Incomplete
Undecided
Unassigned

Bug Description

Exceptions are not structured correctly (at least not friedly) when using method find_resource from openstackclient API from python-glanceclient.

CommandError exception is raised for both NotFound and NoUniqueMatch, error message is different, what is good, but it would be better provide more descriptive exception too.

Related code https://github.com/openstack/python-glanceclient/blob/master/glanceclient/openstack/common/apiclient/utils.py#L72-L100

Revision history for this message
Erno Kuvaja (jokke) wrote :

Hi Marek,

Sorry but the description is not exactly the clearest here. You are talking about openstackclient and python-glanceclient and your link points to incubated apiclient code while the but is targeted to glance.

Would you mind to give example how this behavior is buggy?

Changed in glance:
status: New → Incomplete
Revision history for this message
Marek Aufart (maufart) wrote :

Hi Erno, it is about python-glanceclient.

Example:
 * there are two images with same name in glance, e.g. "some_image"
 * scenario 1:
   * call find_resource method from python-glanceclient with name "some_image"
   * result is CommandError with text Multiple %(name)s matches found for...
 * scenario 2:
    * call find_resource method from python-glanceclient with name "none_image"
   * result is CommandError (again) with text No %(name)s with a name or ID...

 Both scenarios result in same CommandError (but differs in text). From my point of view, it would be nice have two different exception types for that (like glance returns - NotFound or NoUniqueMatch from glanceclient.openstack.common.apiclient).

It is not a high-prio, maybe it is not important if almost of people don't have a problem with that.

Changed in glance:
assignee: nobody → Dharini Chandrasekar (dharini-chandrasekar)
Revision history for this message
Dharini Chandrasekar (dharini-chandrasekar) wrote :

I think the CommandError raised here is appropriate as this piece of code deals with CLI. Also, the exception CommandError raised, has the appropriate messages conveying the right reason.

Changed in glance:
assignee: Dharini Chandrasekar (dharini-chandrasekar) → nobody
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.