diff --git a/swift/proxy/controllers/base.py b/swift/proxy/controllers/base.py index ca12d343eb..6bf7ea0ef6 100644 --- a/swift/proxy/controllers/base.py +++ b/swift/proxy/controllers/base.py @@ -49,7 +49,7 @@ from swift.common.http import is_informational, is_success, is_redirection, \ HTTP_BAD_REQUEST, HTTP_NOT_FOUND, HTTP_SERVICE_UNAVAILABLE, \ HTTP_INSUFFICIENT_STORAGE, HTTP_UNAUTHORIZED, HTTP_CONTINUE from swift.common.swob import Request, Response, HeaderKeyDict, Range, \ - HTTPException, HTTPRequestedRangeNotSatisfiable + HTTPException, HTTPRequestedRangeNotSatisfiable, HTTPServiceUnavailable from swift.common.request_helpers import strip_sys_meta_prefix, \ strip_user_meta_prefix, is_user_meta, is_sys_meta, is_sys_or_user_meta from swift.common.storage_policy import POLICIES @@ -1256,10 +1256,9 @@ class Controller(object): quorum_size=quorum_size) if not resp: - resp = Response(request=req) + resp = HTTPServiceUnavailable(request=req) self.app.logger.error(_('%(type)s returning 503 for %(statuses)s'), {'type': server_type, 'statuses': statuses}) - resp.status = '503 Internal Server Error' return resp diff --git a/test/unit/proxy/controllers/test_base.py b/test/unit/proxy/controllers/test_base.py index 037e28b443..0ebd96eabd 100644 --- a/test/unit/proxy/controllers/test_base.py +++ b/test/unit/proxy/controllers/test_base.py @@ -579,7 +579,7 @@ class TestFuncs(unittest.TestCase): overrides = {302: 204, 100: 204} resp = base.best_response(req, statuses, reasons, bodies, server_type, headers=headers, overrides=overrides) - self.assertEqual(resp.status, '503 Internal Server Error') + self.assertEqual(resp.status, '503 Service Unavailable') # next make a 404 quorum and make sure the last delete (real) 404 # status is the one returned.