]> review.fuel-infra Code Review - openstack-build/cinder-build.git/commitdiff
Convert Retry-After header parameter value to string
authorIvan Kolodyazhny <e0ne@e0ne.info>
Mon, 5 Oct 2015 12:24:28 +0000 (15:24 +0300)
committerIvan Kolodyazhny <e0ne@e0ne.info>
Mon, 5 Oct 2015 12:24:28 +0000 (15:24 +0300)
Cinder doesn't work under Apache well with enabled debug.
In Python 2.x all header values should be a string.

Change-Id: Ie15b5f6836a60a6135ed2808380fa12c3281d5dd
Closes-Bug: #1502881

cinder/api/contrib/backups.py
cinder/api/contrib/volume_transfer.py
cinder/exception.py
cinder/tests/unit/api/middleware/test_faults.py

index 8be8b1fb570385e78d0db8bb325ba1a387f665e1..4cd9e2fa2cc48fbbade30e0e28926de0b566e0de 100644 (file)
@@ -317,10 +317,10 @@ class BackupsController(wsgi.Controller):
             raise exc.HTTPNotFound(explanation=error.msg)
         except exception.VolumeSizeExceedsAvailableQuota as error:
             raise exc.HTTPRequestEntityTooLarge(
-                explanation=error.msg, headers={'Retry-After': 0})
+                explanation=error.msg, headers={'Retry-After': '0'})
         except exception.VolumeLimitExceeded as error:
             raise exc.HTTPRequestEntityTooLarge(
-                explanation=error.msg, headers={'Retry-After': 0})
+                explanation=error.msg, headers={'Retry-After': '0'})
 
         retval = self._view_builder.restore_summary(
             req, dict(new_restore))
index b1358ebd8dbdac70e85cfed9e176761dc97fc07e..d5700ae08df9420294a545d0969ad7c486fb5043 100644 (file)
@@ -208,7 +208,7 @@ class VolumeTransferController(wsgi.Controller):
                                                          auth_key)
         except exception.VolumeSizeExceedsAvailableQuota as error:
             raise exc.HTTPRequestEntityTooLarge(
-                explanation=error.msg, headers={'Retry-After': 0})
+                explanation=error.msg, headers={'Retry-After': '0'})
         except exception.InvalidVolume as error:
             raise exc.HTTPBadRequest(explanation=error.msg)
 
index adaa7554000d4e7f66ac4d1235b49d82cadd7823..9a2b3b6b5ae47e42bc3d9dbf1bca1b2e81ac9fb2 100644 (file)
@@ -441,7 +441,7 @@ class NoMoreTargets(CinderException):
 class QuotaError(CinderException):
     message = _("Quota exceeded: code=%(code)s")
     code = 413
-    headers = {'Retry-After': 0}
+    headers = {'Retry-After': '0'}
     safe = True
 
 
index e31fd97bcfb420287d6ccf7bd3fd30262e7a0f63..f4761c06c7d26e2748a440b159969f3ff1ad5e12 100644 (file)
@@ -72,14 +72,14 @@ class TestFaults(test.TestCase):
         for request in requests:
             exc = webob.exc.HTTPRequestEntityTooLarge
             fault = wsgi.Fault(exc(explanation='sorry',
-                                   headers={'Retry-After': 4}))
+                                   headers={'Retry-After': '4'}))
             response = request.get_response(fault)
 
             expected = {
                 "overLimit": {
                     "message": "sorry",
                     "code": 413,
-                    "retryAfter": 4,
+                    "retryAfter": "4",
                 },
             }
             actual = jsonutils.loads(response.body)