Merge "Return 503 when account auto-create fails"

This commit is contained in:
Zuul 2019-02-06 21:08:57 +00:00 committed by Gerrit Code Review
commit 91ff0917d2
2 changed files with 4 additions and 4 deletions

View File

@ -26,7 +26,7 @@ from swift.proxy.controllers.base import Controller, delay_denial, \
cors_validation, set_info_cache, clear_info_cache
from swift.common.storage_policy import POLICIES
from swift.common.swob import HTTPBadRequest, HTTPForbidden, \
HTTPNotFound, HTTPServerError
HTTPNotFound, HTTPServiceUnavailable
class ContainerController(Controller):
@ -275,7 +275,7 @@ class ContainerController(Controller):
self.account_info(self.account_name, req)
if not accounts and self.app.account_autocreate:
if not self.autocreate_account(req, self.account_name):
return HTTPServerError(request=req)
return HTTPServiceUnavailable(request=req)
account_partition, accounts, container_count = \
self.account_info(self.account_name, req)
if not accounts:

View File

@ -8157,7 +8157,7 @@ class TestContainerController(unittest.TestCase):
# fail to retrieve account info
test_status_map(
(503, 503, 503), # account_info fails on 503
500, missing_container=True)
503, missing_container=True)
# account fail after creation
test_status_map(
(404, 404, 404, # account_info fails on 404
@ -8168,7 +8168,7 @@ class TestContainerController(unittest.TestCase):
(503, 503, 404, # account_info fails on 404
503, 503, 503, # PUT account
503, 503, 404), # account_info fail
500, missing_container=True)
503, missing_container=True)
# put fails
test_status_map(
(404, 404, 404, # account_info fails on 404