Merge "Return 503 when account auto-create fails"
This commit is contained in:
commit
91ff0917d2
@ -26,7 +26,7 @@ from swift.proxy.controllers.base import Controller, delay_denial, \
|
|||||||
cors_validation, set_info_cache, clear_info_cache
|
cors_validation, set_info_cache, clear_info_cache
|
||||||
from swift.common.storage_policy import POLICIES
|
from swift.common.storage_policy import POLICIES
|
||||||
from swift.common.swob import HTTPBadRequest, HTTPForbidden, \
|
from swift.common.swob import HTTPBadRequest, HTTPForbidden, \
|
||||||
HTTPNotFound, HTTPServerError
|
HTTPNotFound, HTTPServiceUnavailable
|
||||||
|
|
||||||
|
|
||||||
class ContainerController(Controller):
|
class ContainerController(Controller):
|
||||||
@ -275,7 +275,7 @@ class ContainerController(Controller):
|
|||||||
self.account_info(self.account_name, req)
|
self.account_info(self.account_name, req)
|
||||||
if not accounts and self.app.account_autocreate:
|
if not accounts and self.app.account_autocreate:
|
||||||
if not self.autocreate_account(req, self.account_name):
|
if not self.autocreate_account(req, self.account_name):
|
||||||
return HTTPServerError(request=req)
|
return HTTPServiceUnavailable(request=req)
|
||||||
account_partition, accounts, container_count = \
|
account_partition, accounts, container_count = \
|
||||||
self.account_info(self.account_name, req)
|
self.account_info(self.account_name, req)
|
||||||
if not accounts:
|
if not accounts:
|
||||||
|
@ -8157,7 +8157,7 @@ class TestContainerController(unittest.TestCase):
|
|||||||
# fail to retrieve account info
|
# fail to retrieve account info
|
||||||
test_status_map(
|
test_status_map(
|
||||||
(503, 503, 503), # account_info fails on 503
|
(503, 503, 503), # account_info fails on 503
|
||||||
500, missing_container=True)
|
503, missing_container=True)
|
||||||
# account fail after creation
|
# account fail after creation
|
||||||
test_status_map(
|
test_status_map(
|
||||||
(404, 404, 404, # account_info fails on 404
|
(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, 404, # account_info fails on 404
|
||||||
503, 503, 503, # PUT account
|
503, 503, 503, # PUT account
|
||||||
503, 503, 404), # account_info fail
|
503, 503, 404), # account_info fail
|
||||||
500, missing_container=True)
|
503, missing_container=True)
|
||||||
# put fails
|
# put fails
|
||||||
test_status_map(
|
test_status_map(
|
||||||
(404, 404, 404, # account_info fails on 404
|
(404, 404, 404, # account_info fails on 404
|
||||||
|
Loading…
Reference in New Issue
Block a user