Merge "Return HTTPServerError instead of HTTPNotFound"
This commit is contained in:
commit
0cf032a75f
@ -1839,9 +1839,11 @@ class Controller(object):
|
|||||||
if is_success(resp.status_int):
|
if is_success(resp.status_int):
|
||||||
self.app.logger.info(_('autocreate account %r'), path)
|
self.app.logger.info(_('autocreate account %r'), path)
|
||||||
clear_info_cache(self.app, req.environ, account)
|
clear_info_cache(self.app, req.environ, account)
|
||||||
|
return True
|
||||||
else:
|
else:
|
||||||
self.app.logger.warning(_('Could not autocreate account %r'),
|
self.app.logger.warning(_('Could not autocreate account %r'),
|
||||||
path)
|
path)
|
||||||
|
return False
|
||||||
|
|
||||||
def GETorHEAD_base(self, req, server_type, node_iter, partition, path,
|
def GETorHEAD_base(self, req, server_type, node_iter, partition, path,
|
||||||
concurrency=1, client_chunk_size=None):
|
concurrency=1, client_chunk_size=None):
|
||||||
|
@ -24,7 +24,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
|
HTTPNotFound, HTTPServerError
|
||||||
|
|
||||||
|
|
||||||
class ContainerController(Controller):
|
class ContainerController(Controller):
|
||||||
@ -160,7 +160,8 @@ class ContainerController(Controller):
|
|||||||
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 and self.app.account_autocreate:
|
if not accounts and self.app.account_autocreate:
|
||||||
self.autocreate_account(req, self.account_name)
|
if not self.autocreate_account(req, self.account_name):
|
||||||
|
return HTTPServerError(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:
|
||||||
|
@ -7825,7 +7825,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
|
||||||
404, missing_container=True)
|
500, 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
|
||||||
@ -7836,7 +7836,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
|
||||||
404, missing_container=True)
|
500, 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…
x
Reference in New Issue
Block a user