]> review.fuel-infra Code Review - openstack-build/cinder-build.git/commitdiff
Squashed commit of WebOb 1.5 and oslo.db fixes
authorDavanum Srinivas <davanum@gmail.com>
Wed, 7 Oct 2015 01:45:12 +0000 (18:45 -0700)
committerMatt Riedemann <mriedem@us.ibm.com>
Tue, 13 Oct 2015 16:30:03 +0000 (09:30 -0700)
Add testresources and testscenarios used by oslo.db fixture

If we use oslo.db fixtures, we'll need these 2 packages or
the next version of oslo.db release will break us.

Closes-Bug: #1503501
Change-Id: I8facdaf69c79b1b1ae4f9f64e9856e12f14440ed
(cherry picked from commit ec40c3b6ddbfa4912ca6e612558efaef6043f3ae)

Fix test_misc for WebOb 1.5

WebOb 1.5 was released at 2015-10-11. With this new version,
webob.exc.WSGIHTTPException() constructor now fails with a KeyError
when the HTTP status code is 0.

test_exceptions_raise() of test_misc tries to instanciate all
exceptions of cinder.exception. The problem is that
ConvertedException uses a default HTTP status code of 0.

Modify the default HTTP status code of ConvertedException to 400 to
fix the unit test. The bug is only in the test,
cinder/api/openstack/wsgi.py copies an existing HTTP code:

    Fault(exception.ConvertedException(code=ex_value.code,  ...)

Closes-Bug: #1505153
Change-Id: I1aec8038774828d48da4b0e831b390e33243809a
(cherry picked from commit 867fccf833ffc597aa986cb6ff1b3b5c1101b9ba)

Change default Exception code to 500

As a part of the fix for LP#1505153, the invalid
response of 0 was changed to 400 to fix a running
issue with the new version of WebOb.

It was pointed out after the fact  however that a
500 might be more appropriate here.

Additionally, other projects have implemented a 500
as the default so for the sake of consistency we should
consider doing the same.

This patch just changes the 400 to a 500 as the default
code.

Conflicts:
        cinder/tests/unit/test_exception.py

NOTE(mriedem): The conflict is due to 17802086f not being
in stable/liberty.

Change-Id: Ie486dc49c927f9b50f07c1fc562e89c090924a40
Closes-Bug: #1505488
(cherry picked from commit 9a7cbe540c94d54194194f4747a52b8211f6372e)

cinder/exception.py
test-requirements.txt

index 5e0715e0e21e3a905883d7af16e3ef2d7ab307e8..de2e3b55fa4f6fcb6c71adea67a18c4fabe48b3a 100644 (file)
@@ -46,7 +46,7 @@ CONF.register_opts(exc_log_opts)
 
 
 class ConvertedException(webob.exc.WSGIHTTPException):
-    def __init__(self, code=0, title="", explanation=""):
+    def __init__(self, code=500, title="", explanation=""):
         self.code = code
         self.title = title
         self.explanation = explanation
index 04d0086bb8a41b32c2eb66c4395437914692511c..8982c803b8a104a3743681e3c64e3cf94d7b3a19 100644 (file)
@@ -17,6 +17,8 @@ sphinx!=1.2.0,!=1.3b1,<1.3,>=1.1.2
 python-subunit>=0.0.18
 testtools>=1.4.0
 testrepository>=0.0.18
+testresources>=0.2.4
+testscenarios>=0.4
 oslosphinx>=2.5.0 # Apache-2.0
 os-testr>=0.1.0
 tempest-lib>=0.8.0