Not found router raises generic exception

Bug #1284317 reported by Matthew D. Wood
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
OpenStack Dashboard (Horizon)
Fix Released
Medium
Matthew D. Wood

Bug Description

As a horizon developer, I use the neutronclient package, which currently provides several exceptions that horizon can catch, including NetworkNotFoundClient, and PortNotFoundClient. Unfortunately, there is no RouterNotFoundClient exception. When an api call is made to get a router_id that doesn't exist, a very generic NeutronClientException is raised which is significantly problematic. (Though it does have a status_code of 404, and an error message saying "Router <id> could not be found" which is good.)

I'd like for a new exception to be thrown so we can catch it and treat it as a NOT_FOUND error instead of having to parse it and fight changing-error-messages and the like.

Tags: neutron
Changed in neutron:
assignee: nobody → Carl Baldwin (carl-baldwin)
Changed in horizon:
assignee: nobody → Matthew D. Wood (woodm1979)
Revision history for this message
Oleg Bondarev (obondarev) wrote :

Looks like a neutronclient bug

Revision history for this message
Matthew D. Wood (woodm1979) wrote :

Oleg, you're right. But once it's fixed in the neutronclient, there will be a new exception type that we need to add to openstack_dashboards.exceptions.NOT_FOUND, which is why I put in the horizon component.

Revision history for this message
Akihiro Motoki (amotoki) wrote :

It is better to define a base NotFound exception class in neutronclient rather than dealing with specific NotFound error. If 404 response is returned from Neutron, NotFound base exception class is used. (For network/port not found, the existing class should be used.)

In Horizon, what we need to do is to add NotFound class above and remove Network/PortNotFound class from horizon exceptions.NOT_FOUND list.

affects: neutron → python-neutronclient
Changed in horizon:
status: New → Triaged
Changed in python-neutronclient:
status: New → Triaged
importance: Undecided → Medium
Changed in horizon:
importance: Undecided → Medium
Revision history for this message
Akihiro Motoki (amotoki) wrote :

The related project is changed from neutron to neutronclient. Let me take it in neutronclient.
I would like to fix it by introducing general base exception classes per HTTP response.
I believe we can avoid adding new neutron exceptions in Horizon exception list.

Changed in python-neutronclient:
assignee: Carl Baldwin (carl-baldwin) → Akihiro Motoki (amotoki)
Revision history for this message
Carl Baldwin (carl-baldwin) wrote :

Somehow the bot never linked my change: https://review.openstack.org/#/c/76088/

Revision history for this message
Akihiro Motoki (amotoki) wrote :

Carl, thanks for the link. I reassigned this bug to you.

Changed in python-neutronclient:
assignee: Akihiro Motoki (amotoki) → Carl Baldwin (carl-baldwin)
Revision history for this message
Akihiro Motoki (amotoki) wrote :

I proposed a more generic approach in bug 1296148 and https://review.openstack.org/82319.
I am not sure we need an exception specific to Router Not Found.

Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Related fix proposed to horizon (master)

Related fix proposed to branch: master
Review: https://review.openstack.org/82320

Revision history for this message
Carl Baldwin (carl-baldwin) wrote :

Akihiro, your change doesn't seem to address this bug. We have PortNotFound and NetworkNotFound. Your patch preserves those. If those are needed then why wouldn't RouterNotFound be needed as well?

Revision history for this message
Akihiro Motoki (amotoki) wrote :

@Carl
Yes if you need to know RouterNotFound explicitly. I am okay adding RouterNotFound, but how about other resources? I just would like to avoid dealing with specific cases in ad-hoc way.

I think NotFound exception is enough in most cases. For example, NotFound exception for router_show means the router is not found. Horizon side patch catches all exceptions which inherit NotFound. As Horizon developer it is enough, but it is my opinion.

@Matthew
Is NotFound with a message "Router <id> could not be found enough? Or do you think explicit RouterNotFound is needed?

Revision history for this message
Matthew D. Wood (woodm1979) wrote :

I think adding the RouterNotFound exceptions makes sense. It's consistent with what Neutron has now. That said, I do understand not wanting to have that list proliferate too much.

I'm a HUGE fan of the reorganization that you've done. And having a NotFound exception that can be subclassed is most definitely the way to go.

If we do add the RouterNotFound, it won't hurt anything, and horizon can still catch NotFound exceptions. I think that's the most complete and correct way to handle this.

Revision history for this message
Carl Baldwin (carl-baldwin) wrote :

I'll defer to Matthew and I'll be happy with what you work out.

Revision history for this message
Henrique Truta (henriquetruta) wrote :

Is there anyone currently working on this bug?

Revision history for this message
Matthew D. Wood (woodm1979) wrote : Re: [Bug 1284317] Re: Not found router raises generic exception

I think this may have been resolved through some other means. But I'm
really not sure.

I tried looking back through some emails and searching the bugs (though not
very hard) and can't find it.

I seem to recall that there's an umbrella exception for Neutron.NotFound
now, and so my previous issue was solved. That said, I can't see a reason
not to have RouterNotFound exist if the other exceptions exist.

--
Matthew Wood

Big Jiu Jitsu Noob
Brand new daughter who's so cute
Soon she'll submit me

On Mon, Jul 7, 2014 at 8:49 AM, Henrique Truta <email address hidden>
wrote:

> Is there anyone currently working on this bug?
>
> --
> You received this bug notification because you are subscribed to the bug
> report.
> https://bugs.launchpad.net/bugs/1284317
>
> Title:
> Not found router raises generic exception
>
> Status in OpenStack Dashboard (Horizon):
> Triaged
> Status in Python client library for Neutron:
> Triaged
>
> Bug description:
> As a horizon developer, I use the neutronclient package, which
> currently provides several exceptions that horizon can catch,
> including NetworkNotFoundClient, and PortNotFoundClient.
> Unfortunately, there is no RouterNotFoundClient exception. When an
> api call is made to get a router_id that doesn't exist, a very generic
> NeutronClientException is raised which is significantly problematic.
> (Though it does have a status_code of 404, and an error message saying
> "Router <id> could not be found" which is good.)
>
> I'd like for a new exception to be thrown so we can catch it and treat
> it as a NOT_FOUND error instead of having to parse it and fight
> changing-error-messages and the like.
>
> To manage notifications about this bug go to:
> https://bugs.launchpad.net/horizon/+bug/1284317/+subscriptions
>

Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Related fix merged to horizon (master)

Reviewed: https://review.openstack.org/82320
Committed: https://git.openstack.org/cgit/openstack/horizon/commit/?id=a1fdb4709c8fa2a1766732b65d28462a3bf6eb4a
Submitter: Jenkins
Branch: master

commit a1fdb4709c8fa2a1766732b65d28462a3bf6eb4a
Author: Akihiro Motoki <email address hidden>
Date: Sun Mar 23 06:46:05 2014 +0900

    Update exception map based on neutronclient exception rearrange

    Change-Id: I59f31d269f97d86ce9b681dc7714c9a10892a3a2
    Closes-Bug: #1296148
    Related-Bug: #1284317

Revision history for this message
Akihiro Motoki (amotoki) wrote :

Honestly speaking, I am not sure how to handle this bug both on neutronclient and horizon.

We already have the umbrella exception NotFound. Horizon code catches NotFound and handle exception appropriately. Neutronclient raises NotFound exception for RouterNotFound in Neutron side and NotFound exception works for most cases though RouterNotFound still makes sense if it is needed.

I would like to change this bug to "WishList" as neutronclient bug.

For Horizon bug I don't see a strong reason we need a specific RouterNotFound bug after the commit a1fdb4709c8fa2a1766732b (above), so I would like to mark it as "Fix Commited" (I believe the above commit address this bug).

Changed in horizon:
importance: Medium → Wishlist
importance: Wishlist → Medium
status: Triaged → Fix Committed
milestone: none → juno-3
Changed in python-neutronclient:
importance: Medium → Wishlist
tags: added: neutron
Thierry Carrez (ttx)
Changed in horizon:
status: Fix Committed → Fix Released
Thierry Carrez (ttx)
Changed in horizon:
milestone: juno-3 → 2014.2
Revision history for this message
Armando Migliaccio (armando-migliaccio) wrote :

This bug is > 172 days without activity. We are unsetting assignee and milestone and setting status to Incomplete in order to allow its expiry in 60 days.

If the bug is still valid, then update the bug status.

Changed in python-neutronclient:
assignee: Carl Baldwin (carl-baldwin) → nobody
status: Triaged → Incomplete
Revision history for this message
Armando Migliaccio (armando-migliaccio) wrote :

This bug is > 180 days without activity. We are unsetting assignee and milestone and setting status to Incomplete in order to allow its expiry in 60 days.

If the bug is still valid, then update the bug status.

no longer affects: python-neutronclient
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.