webob.exc.HTTPBadRequest doesn't accept parameter 'reason'

Bug #1264223 reported by Kiyohiro Adachi
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
Cinder
Fix Released
Undecided
Kiyohiro Adachi
OpenStack Compute (nova)
Fix Released
Undecided
ZhiQiang Fan

Bug Description

If the specific error message is required, we must set explanation='message' to initialize subclass of webob.exc.WSGIHTTPException(). There is some code specify the message to 'reason' incorrectly.

Ex.
OK: raise webob.exc.HTTPBadRequest(explanation=_('What?'))
WRONG: raise webob.exc.HTTPBadRequest(reason=_("What's up?"))

Kiyohiro Adachi (adachi)
Changed in cinder:
assignee: nobody → Kiyohiro Adachi (adachi)
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix proposed to cinder (master)

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

Changed in cinder:
status: New → In Progress
Revision history for this message
Kiyohiro Adachi (adachi) wrote : Re: WSGIHTTPException needs ``explanation`` attribute

I learned that there is a case there may be no "explanation='message'".
But I think the following is a bug at least.

in cinder/api/contrib/scheduler_hints.py

raise webob.exc.HTTPBadRequest(reason=msg)

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

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

ZhiQiang Fan (aji-zqfan)
Changed in nova:
assignee: nobody → ZhiQiang Fan (aji-zqfan)
ZhiQiang Fan (aji-zqfan)
description: updated
summary: - WSGIHTTPException needs ``explanation`` attribute
+ webob.exc.HTTPBadRequest doesn't accept parameter 'reason'
ZhiQiang Fan (aji-zqfan)
description: updated
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix proposed to nova (master)

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

Changed in nova:
status: New → In Progress
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix merged to cinder (master)

Reviewed: https://review.openstack.org/64099
Committed: https://git.openstack.org/cgit/openstack/cinder/commit/?id=534ce5dde117a61abbab49e8b1bc34b5fcbfc095
Submitter: Jenkins
Branch: master

commit 534ce5dde117a61abbab49e8b1bc34b5fcbfc095
Author: KIYOHIRO ADACHI <email address hidden>
Date: Thu Dec 26 16:09:01 2013 +0900

    Fix the invalid argument of webob.exc.HTTPBadRequest

    webob.exc.HTTPBadRequest() does not have a parameter 'reason'.

    Change-Id: I65103ce72849e921150c4d098993fa523f53fe3a
    Closes-Bug: #1264223

Changed in cinder:
status: In Progress → Fix Committed
Thierry Carrez (ttx)
Changed in cinder:
milestone: none → icehouse-2
status: Fix Committed → Fix Released
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix merged to nova (master)

Reviewed: https://review.openstack.org/64264
Committed: https://git.openstack.org/cgit/openstack/nova/commit/?id=c049f99a1016083af598362983d4335f210f7f0e
Submitter: Jenkins
Branch: master

commit c049f99a1016083af598362983d4335f210f7f0e
Author: ZhiQiang Fan <email address hidden>
Date: Thu Dec 26 16:47:31 2013 +0800

    Fix incorrect kwargs 'reason' for HTTPBadRequest

    webob.exc.HTTPBadRequest doesn't have attribute 'reason', and its
    __init__ method doesn't have such parameter too, so if we use such
    kwargs, it will not be accepted by constructor of base class
    WSGIHTTPException, then the http response body will format message
    using default explanation instead of what we expected.

    We should use kwargs 'explanation' instead of wrong 'reason'.

    Change-Id: I02619164176a723e313ae274e527948d45fa6cad
    Closes-Bug: #1264223

Changed in nova:
status: In Progress → Fix Committed
Changed in nova:
milestone: none → icehouse-rc1
Thierry Carrez (ttx)
Changed in nova:
status: Fix Committed → Fix Released
Thierry Carrez (ttx)
Changed in nova:
milestone: icehouse-rc1 → 2014.1
Thierry Carrez (ttx)
Changed in cinder:
milestone: icehouse-2 → 2014.1
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.