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:
Arnaud JOST 2015-02-18 11:56:11 +01:00
parent a6091c0f39
commit 7bc09dfdea
2 changed files with 7 additions and 3 deletions

View File

@ -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):
"""

View File

@ -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,