Add support of x-remove- headers for container-sync
If the used tool to send header doesn't support empty headers (older versions of curl), x-remove can be used to remove metadata. sync-key and sync-to metadata, used by container-sync, can now be removed using x-remove headers. Change-Id: I0edb4d5425a99d20a973aa4fceaf9af6c2ddecc0
This commit is contained in:
parent
a6091c0f39
commit
7bc09dfdea
@ -46,7 +46,9 @@ class ContainerController(Controller):
|
||||
st = self.server_type.lower()
|
||||
return ['x-remove-%s-read' % st,
|
||||
'x-remove-%s-write' % st,
|
||||
'x-remove-versions-location']
|
||||
'x-remove-versions-location',
|
||||
'x-remove-%s-sync-key' % st,
|
||||
'x-remove-%s-sync-to' % st]
|
||||
|
||||
def _convert_policy_to_index(self, req):
|
||||
"""
|
||||
|
@ -5345,13 +5345,15 @@ class TestContainerController(unittest.TestCase):
|
||||
|
||||
def test_transfer_headers(self):
|
||||
src_headers = {'x-remove-versions-location': 'x',
|
||||
'x-container-read': '*:user'}
|
||||
'x-container-read': '*:user',
|
||||
'x-remove-container-sync-key': 'x'}
|
||||
dst_headers = {'x-versions-location': 'backup'}
|
||||
controller = swift.proxy.controllers.ContainerController(self.app,
|
||||
'a', 'c')
|
||||
controller.transfer_headers(src_headers, dst_headers)
|
||||
expected_headers = {'x-versions-location': '',
|
||||
'x-container-read': '*:user'}
|
||||
'x-container-read': '*:user',
|
||||
'x-container-sync-key': ''}
|
||||
self.assertEqual(dst_headers, expected_headers)
|
||||
|
||||
def assert_status_map(self, method, statuses, expected,
|
||||
|
Loading…
Reference in New Issue
Block a user