Plumgrid plugin raises exceptions incorrectly

Bug #1204321 reported by Mohammad Banikazemi
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
neutron
Fix Released
Low
Mohammad Banikazemi

Bug Description

Plumgrid plugin exception class PLUMgridException is derived from NeutronException class (plugins / plumgrid / common / exceptions.py):

class PLUMgridException(base_exec.NeutronException):
    message = _("An unexpected error occurred in the PLUMgrid Plugin: "
                "%(err_msg)s")

However, the plugin raises this exception incorrectly in several locations by using something like this:

                err_message = _("PLUMgrid NOS communication failed: ")
                LOG.Exception(err_message)
                raise plum_excep.PLUMgridException(err_message)

I simply noticed this reading the code so I thought I should report it. The fix is rather straightforward but wanted to check with others before fixing it.

tags: added: low-hanging-fruit
Changed in neutron:
importance: Undecided → Low
status: New → Triaged
tags: added: plumgrid
Changed in neutron:
assignee: nobody → Mohammad Banikazemi (mb-s)
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix proposed to neutron (master)

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

Changed in neutron:
status: Triaged → In Progress
Revision history for this message
OpenStack Infra (hudson-openstack) wrote :

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

Revision history for this message
OpenStack Infra (hudson-openstack) wrote :

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

Revision history for this message
ZhiQiang Fan (aji-zqfan) wrote :

I read neutron/plugins/plumgrid/common/exceptions.py, and greped in that plugin directory, and find that:
class PLUMgridConnectionFailed(PLUMgridException) is not used in anywhere.
And i read plumgrid_plugin.py, all exceptions' message are 'PLUMgrid NOS communication failed'(some of them have additional ' : ' str in the end).
And in rest_connection.py, the only exception message is "PLUMgrid HTTP Connection Failed: " (and there is a meanless 'pass' statement in the try block). I think PLUMgridConnectionFailed should be used instead of PLUMgridException here, and may be in plumgrid_plugin.py because most of them are raised by communication problem.

Anyway, the err_message should passed in dict parameter.

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

Reviewed: https://review.openstack.org/38569
Committed: http://github.com/openstack/neutron/commit/8f81d21ef144f93a9d4f71624d5c0b8b65a1f4d1
Submitter: Jenkins
Branch: master

commit 8f81d21ef144f93a9d4f71624d5c0b8b65a1f4d1
Author: sysnet <email address hidden>
Date: Wed Jul 24 19:50:04 2013 -0400

    Passing the error message as keyword argument

    as expected by the base exception class
    (OpenstackException) which does not accept
    any positional arguments

    Fixes: bug #1204321
    Change-Id: I320807f6f629fc337a612ad2f9c55ae2c156cfd9

Changed in neutron:
status: In Progress → Fix Committed
Changed in neutron:
milestone: none → havana-3
Thierry Carrez (ttx)
Changed in neutron:
status: Fix Committed → Fix Released
Thierry Carrez (ttx)
Changed in neutron:
milestone: havana-3 → 2013.2
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.