From: Ivan Kolodyazhny Date: Mon, 5 Oct 2015 12:24:28 +0000 (+0300) Subject: Convert Retry-After header parameter value to string X-Git-Url: https://review.fuel-infra.org/gitweb?a=commitdiff_plain;h=045c26dd6c5868491622e470a5248a8389fc5f2b;p=openstack-build%2Fcinder-build.git Convert Retry-After header parameter value to string 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 --- diff --git a/cinder/api/contrib/backups.py b/cinder/api/contrib/backups.py index 8be8b1fb5..4cd9e2fa2 100644 --- a/cinder/api/contrib/backups.py +++ b/cinder/api/contrib/backups.py @@ -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)) diff --git a/cinder/api/contrib/volume_transfer.py b/cinder/api/contrib/volume_transfer.py index b1358ebd8..d5700ae08 100644 --- a/cinder/api/contrib/volume_transfer.py +++ b/cinder/api/contrib/volume_transfer.py @@ -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) diff --git a/cinder/exception.py b/cinder/exception.py index adaa75540..9a2b3b6b5 100644 --- a/cinder/exception.py +++ b/cinder/exception.py @@ -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 diff --git a/cinder/tests/unit/api/middleware/test_faults.py b/cinder/tests/unit/api/middleware/test_faults.py index e31fd97bc..f4761c06c 100644 --- a/cinder/tests/unit/api/middleware/test_faults.py +++ b/cinder/tests/unit/api/middleware/test_faults.py @@ -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)