Merge "s3api: Get rid of slo_enabled flag"
This commit is contained in:
commit
4ee05c5ddc
@ -280,9 +280,7 @@ class S3ApiMiddleware(object):
|
||||
|
||||
self.logger = get_logger(
|
||||
conf, log_route=conf.get('log_name', 's3api'))
|
||||
self.slo_enabled = self.conf.allow_multipart_uploads
|
||||
self.check_pipeline(self.conf)
|
||||
self.conf.slo_enabled = self.slo_enabled
|
||||
|
||||
def __call__(self, env, start_response):
|
||||
try:
|
||||
@ -350,8 +348,8 @@ class S3ApiMiddleware(object):
|
||||
pipeline.index('proxy-server')]
|
||||
|
||||
# Check SLO middleware
|
||||
if self.slo_enabled and 'slo' not in auth_pipeline:
|
||||
self.slo_enabled = False
|
||||
if self.conf.allow_multipart_uploads and 'slo' not in auth_pipeline:
|
||||
self.conf.allow_multipart_uploads = False
|
||||
self.logger.warning('s3api middleware requires SLO middleware '
|
||||
'to support multi-part upload, please add it '
|
||||
'in pipeline')
|
||||
|
@ -1018,7 +1018,7 @@ class S3Request(swob.Request):
|
||||
if self.is_service_request:
|
||||
return ServiceController
|
||||
|
||||
if not self.conf.slo_enabled:
|
||||
if not self.conf.allow_multipart_uploads:
|
||||
multi_part = ['partNumber', 'uploadId', 'uploads']
|
||||
if len([p for p in multi_part if p in self.params]):
|
||||
raise S3NotImplemented("Multi-part feature isn't support")
|
||||
|
@ -153,7 +153,6 @@ def mktime(timestamp_str, time_format='%Y-%m-%dT%H:%M:%S'):
|
||||
|
||||
class Config(dict):
|
||||
DEFAULTS = {
|
||||
'slo_enabled': True,
|
||||
'storage_domain': '',
|
||||
'location': 'us-east-1',
|
||||
'force_swift_request_proxy_log': False,
|
||||
|
@ -123,7 +123,6 @@ class TestS3ApiMiddleware(S3ApiTestCase):
|
||||
|
||||
# check all non-defaults are loaded
|
||||
conf = {
|
||||
'slo_enabled': False,
|
||||
'storage_domain': 'somewhere',
|
||||
'location': 'us-west-1',
|
||||
'force_swift_request_proxy_log': True,
|
||||
|
@ -1112,7 +1112,7 @@ class TestSigV4Request(S3ApiTestCase):
|
||||
do_check_bad(Config({'location': 'us-east-1'}), bad_params,
|
||||
s3response.AuthorizationQueryParametersError)
|
||||
|
||||
def test_controller_slo_enabled(self):
|
||||
def test_controller_allow_multipart_uploads(self):
|
||||
environ = {
|
||||
'HTTP_HOST': 'bucket.s3.test.com',
|
||||
'REQUEST_METHOD': 'GET'}
|
||||
@ -1144,9 +1144,10 @@ class TestSigV4Request(S3ApiTestCase):
|
||||
self.assertEqual(controllers.multi_upload.UploadsController,
|
||||
s3req.controller)
|
||||
|
||||
# multi part requests require slo_enabled
|
||||
# multi part requests require allow_multipart_uploads
|
||||
def do_check_slo_not_enabled(params):
|
||||
s3req = make_s3req(Config({'slo_enabled': False}), '/bkt', params)
|
||||
s3req = make_s3req(Config({
|
||||
'allow_multipart_uploads': False}), '/bkt', params)
|
||||
self.assertRaises(s3response.S3NotImplemented,
|
||||
lambda: s3req.controller)
|
||||
|
||||
@ -1154,11 +1155,11 @@ class TestSigV4Request(S3ApiTestCase):
|
||||
do_check_slo_not_enabled({'uploadId': '4'})
|
||||
do_check_slo_not_enabled({'uploads': '99'})
|
||||
|
||||
# service requests not dependent on slo_enabled
|
||||
# service requests not dependent on allow_multipart_uploads
|
||||
s3req = make_s3req(Config(), '/', {'partNumber': '3'})
|
||||
self.assertEqual(controllers.ServiceController,
|
||||
s3req.controller)
|
||||
s3req = make_s3req(Config({'slo_enabled': False}), '/',
|
||||
s3req = make_s3req(Config({'allow_multipart_uploads': False}), '/',
|
||||
{'partNumber': '3'})
|
||||
self.assertEqual(controllers.ServiceController,
|
||||
s3req.controller)
|
||||
|
@ -133,7 +133,6 @@ class TestS3ApiUtils(unittest.TestCase):
|
||||
class TestConfig(unittest.TestCase):
|
||||
|
||||
def _assert_defaults(self, conf):
|
||||
self.assertTrue(conf.slo_enabled)
|
||||
self.assertEqual('', conf.storage_domain)
|
||||
self.assertEqual('us-east-1', conf.location)
|
||||
self.assertFalse(conf.force_swift_request_proxy_log)
|
||||
@ -146,7 +145,6 @@ class TestConfig(unittest.TestCase):
|
||||
# deliberately brittle so new defaults will need to be added to test
|
||||
conf = utils.Config()
|
||||
self._assert_defaults(conf)
|
||||
del conf.slo_enabled
|
||||
del conf.storage_domain
|
||||
del conf.location
|
||||
del conf.force_swift_request_proxy_log
|
||||
@ -163,8 +161,8 @@ class TestConfig(unittest.TestCase):
|
||||
self.assertEqual(conf.key1, 'val1')
|
||||
self.assertEqual(conf.key2, 'val2')
|
||||
|
||||
conf.update({'slo_enabled': False})
|
||||
self.assertFalse(conf.slo_enabled)
|
||||
conf.update({'allow_multipart_uploads': False})
|
||||
self.assertFalse(conf.allow_multipart_uploads)
|
||||
|
||||
def test_set_get_delete(self):
|
||||
conf = utils.Config()
|
||||
|
Loading…
Reference in New Issue
Block a user