Merge "s3api: Fix get_container_info missing some sysmeta info."
This commit is contained in:
commit
934074856c
|
@ -90,6 +90,8 @@ def _header_strip(value):
|
|||
# behave as though it wasn't provided
|
||||
return None
|
||||
return stripped
|
||||
|
||||
|
||||
_header_strip.re = re.compile('^[\x00-\x20]*|[\x00-\x20]*$')
|
||||
|
||||
|
||||
|
@ -1427,8 +1429,10 @@ class S3Request(swob.Request):
|
|||
else:
|
||||
# otherwise we do naive HEAD request with the authentication
|
||||
resp = self.get_response(app, 'HEAD', self.container_name, '')
|
||||
headers = resp.sw_headers.copy()
|
||||
headers.update(resp.sysmeta_headers)
|
||||
return headers_to_container_info(
|
||||
resp.sw_headers, resp.status_int) # pylint: disable-msg=E1101
|
||||
headers, resp.status_int) # pylint: disable-msg=E1101
|
||||
|
||||
def gen_multipart_manifest_delete_query(self, app, obj=None):
|
||||
if not self.allow_multipart_uploads:
|
||||
|
|
|
@ -302,9 +302,14 @@ class TestRequest(S3ApiTestCase):
|
|||
self.assertTrue(sw_req.environ['swift.proxy_access_log_made'])
|
||||
|
||||
def test_get_container_info(self):
|
||||
s3api_acl = '{"Owner":"owner","Grant":'\
|
||||
'[{"Grantee":"owner","Permission":"FULL_CONTROL"}]}'
|
||||
self.swift.register('HEAD', '/v1/AUTH_test/bucket', HTTPNoContent,
|
||||
{'x-container-read': 'foo',
|
||||
'X-container-object-count': 5,
|
||||
'x-container-sysmeta-versions-location':
|
||||
'bucket2',
|
||||
'x-container-sysmeta-s3api-acl': s3api_acl,
|
||||
'X-container-meta-foo': 'bar'}, None)
|
||||
req = Request.blank('/bucket', environ={'REQUEST_METHOD': 'GET'},
|
||||
headers={'Authorization': 'AWS test:tester:hmac',
|
||||
|
@ -316,6 +321,9 @@ class TestRequest(S3ApiTestCase):
|
|||
self.assertEqual(204, info['status']) # sanity
|
||||
self.assertEqual('foo', info['read_acl']) # sanity
|
||||
self.assertEqual('5', info['object_count']) # sanity
|
||||
self.assertEqual(
|
||||
'bucket2', info['sysmeta']['versions-location']) # sanity
|
||||
self.assertEqual(s3api_acl, info['sysmeta']['s3api-acl']) # sanity
|
||||
self.assertEqual({'foo': 'bar'}, info['meta']) # sanity
|
||||
with patch(
|
||||
'swift.common.middleware.s3api.s3request.get_container_info',
|
||||
|
|
Loading…
Reference in New Issue