Merge "Set swift_source more in s3api middleware"
This commit is contained in:
commit
f97c34d77d
doc/source
swift/common/middleware/s3api
test/unit/common/middleware/s3api
@ -139,6 +139,7 @@ VW :ref:`versioned_writes`
|
|||||||
SSC :ref:`copy`
|
SSC :ref:`copy`
|
||||||
SYM :ref:`symlink`
|
SYM :ref:`symlink`
|
||||||
SH :ref:`sharding_doc`
|
SH :ref:`sharding_doc`
|
||||||
|
S3 :ref:`s3api`
|
||||||
======================= =============================
|
======================= =============================
|
||||||
|
|
||||||
|
|
||||||
|
@ -1218,7 +1218,7 @@ class S3Request(swob.Request):
|
|||||||
|
|
||||||
def _bucket_put_accepted_error(self, container, app):
|
def _bucket_put_accepted_error(self, container, app):
|
||||||
sw_req = self.to_swift_req('HEAD', container, None)
|
sw_req = self.to_swift_req('HEAD', container, None)
|
||||||
info = get_container_info(sw_req.environ, app)
|
info = get_container_info(sw_req.environ, app, swift_source='S3')
|
||||||
sysmeta = info.get('sysmeta', {})
|
sysmeta = info.get('sysmeta', {})
|
||||||
try:
|
try:
|
||||||
acl = json.loads(sysmeta.get('s3api-acl',
|
acl = json.loads(sysmeta.get('s3api-acl',
|
||||||
@ -1429,7 +1429,7 @@ class S3Request(swob.Request):
|
|||||||
# if we have already authenticated, yes we can use the account
|
# if we have already authenticated, yes we can use the account
|
||||||
# name like as AUTH_xxx for performance efficiency
|
# name like as AUTH_xxx for performance efficiency
|
||||||
sw_req = self.to_swift_req(app, self.container_name, None)
|
sw_req = self.to_swift_req(app, self.container_name, None)
|
||||||
info = get_container_info(sw_req.environ, app)
|
info = get_container_info(sw_req.environ, app, swift_source='S3')
|
||||||
if is_success(info['status']):
|
if is_success(info['status']):
|
||||||
return info
|
return info
|
||||||
elif info['status'] == 404:
|
elif info['status'] == 404:
|
||||||
|
@ -251,7 +251,7 @@ class TestS3ApiMultiUpload(S3ApiTestCase):
|
|||||||
|
|
||||||
@s3acl
|
@s3acl
|
||||||
@patch('swift.common.middleware.s3api.s3request.get_container_info',
|
@patch('swift.common.middleware.s3api.s3request.get_container_info',
|
||||||
lambda x, y: {'status': 404})
|
lambda env, app, swift_source: {'status': 404})
|
||||||
def test_bucket_multipart_uploads_GET_without_bucket(self):
|
def test_bucket_multipart_uploads_GET_without_bucket(self):
|
||||||
self.swift.register('HEAD', '/v1/AUTH_test/bucket',
|
self.swift.register('HEAD', '/v1/AUTH_test/bucket',
|
||||||
swob.HTTPNotFound, {}, '')
|
swob.HTTPNotFound, {}, '')
|
||||||
@ -784,7 +784,7 @@ class TestS3ApiMultiUpload(S3ApiTestCase):
|
|||||||
body=XML)
|
body=XML)
|
||||||
with patch(
|
with patch(
|
||||||
'swift.common.middleware.s3api.s3request.get_container_info',
|
'swift.common.middleware.s3api.s3request.get_container_info',
|
||||||
lambda x, y: {'status': 404}):
|
lambda env, app, swift_source: {'status': 404}):
|
||||||
self.swift.register('HEAD', '/v1/AUTH_test/nobucket',
|
self.swift.register('HEAD', '/v1/AUTH_test/nobucket',
|
||||||
swob.HTTPNotFound, {}, None)
|
swob.HTTPNotFound, {}, None)
|
||||||
status, headers, body = self.call_s3api(req)
|
status, headers, body = self.call_s3api(req)
|
||||||
@ -1304,7 +1304,7 @@ class TestS3ApiMultiUpload(S3ApiTestCase):
|
|||||||
'Date': self.get_date_header()})
|
'Date': self.get_date_header()})
|
||||||
with patch(
|
with patch(
|
||||||
'swift.common.middleware.s3api.s3request.get_container_info',
|
'swift.common.middleware.s3api.s3request.get_container_info',
|
||||||
lambda x, y: {'status': 404}):
|
lambda env, app, swift_source: {'status': 404}):
|
||||||
self.swift.register('HEAD', '/v1/AUTH_test/nobucket',
|
self.swift.register('HEAD', '/v1/AUTH_test/nobucket',
|
||||||
swob.HTTPNotFound, {}, None)
|
swob.HTTPNotFound, {}, None)
|
||||||
status, headers, body = self.call_s3api(req)
|
status, headers, body = self.call_s3api(req)
|
||||||
@ -1320,8 +1320,8 @@ class TestS3ApiMultiUpload(S3ApiTestCase):
|
|||||||
self.assertEqual(status.split()[0], '204')
|
self.assertEqual(status.split()[0], '204')
|
||||||
|
|
||||||
@s3acl
|
@s3acl
|
||||||
@patch('swift.common.middleware.s3api.s3request.'
|
@patch('swift.common.middleware.s3api.s3request.get_container_info',
|
||||||
'get_container_info', lambda x, y: {'status': 204})
|
lambda env, app, swift_source: {'status': 204})
|
||||||
def test_object_upload_part_error(self):
|
def test_object_upload_part_error(self):
|
||||||
# without upload id
|
# without upload id
|
||||||
req = Request.blank('/bucket/object?partNumber=1',
|
req = Request.blank('/bucket/object?partNumber=1',
|
||||||
@ -1367,7 +1367,7 @@ class TestS3ApiMultiUpload(S3ApiTestCase):
|
|||||||
body='part object')
|
body='part object')
|
||||||
with patch(
|
with patch(
|
||||||
'swift.common.middleware.s3api.s3request.get_container_info',
|
'swift.common.middleware.s3api.s3request.get_container_info',
|
||||||
lambda x, y: {'status': 404}):
|
lambda env, app, swift_source: {'status': 404}):
|
||||||
self.swift.register('HEAD', '/v1/AUTH_test/nobucket',
|
self.swift.register('HEAD', '/v1/AUTH_test/nobucket',
|
||||||
swob.HTTPNotFound, {}, None)
|
swob.HTTPNotFound, {}, None)
|
||||||
status, headers, body = self.call_s3api(req)
|
status, headers, body = self.call_s3api(req)
|
||||||
@ -1399,7 +1399,7 @@ class TestS3ApiMultiUpload(S3ApiTestCase):
|
|||||||
'Date': self.get_date_header()})
|
'Date': self.get_date_header()})
|
||||||
with patch(
|
with patch(
|
||||||
'swift.common.middleware.s3api.s3request.get_container_info',
|
'swift.common.middleware.s3api.s3request.get_container_info',
|
||||||
lambda x, y: {'status': 404}):
|
lambda env, app, swift_source: {'status': 404}):
|
||||||
self.swift.register('HEAD', '/v1/AUTH_test/nobucket',
|
self.swift.register('HEAD', '/v1/AUTH_test/nobucket',
|
||||||
swob.HTTPNotFound, {}, None)
|
swob.HTTPNotFound, {}, None)
|
||||||
status, headers, body = self.call_s3api(req)
|
status, headers, body = self.call_s3api(req)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user