Change with_data=False for swift_get_container

This function is only used in the Container get
method which retrieves details about a container.

It's not used for listing data in the container
even though with_data was True doing a GET instead
of a HEAD on the container.

This indirectly also fixes the Ceph bug [1] in the
Swift API implementation that doesn't expose metadata
correctly for a GET but does for a HEAD.

[1] https://tracker.ceph.com/issues/47861

Change-Id: Iba4215b2e3a414d1794faa05be31bf69e0e48bec
This commit is contained in:
Tobias Urdin 2021-03-30 17:49:18 +02:00
parent 5e4ca1a9fd
commit c87f0e7a90
2 changed files with 3 additions and 2 deletions

View File

@ -176,7 +176,7 @@ def swift_get_containers(request, marker=None, prefix=None):
@profiler.trace
@safe_swift_exception
def swift_get_container(request, container_name, with_data=True):
def swift_get_container(request, container_name, with_data=False):
if with_data:
headers, data = swift_api(request).get_object(container_name, "")
else:

View File

@ -44,7 +44,8 @@ class SwiftApiTests(test.APIMockTestCase):
swift_api = mock_swiftclient.return_value
swift_api.get_object.return_value = (container, objects)
cont = api.swift.swift_get_container(self.request, container.name)
cont = api.swift.swift_get_container(self.request, container.name,
with_data=True)
self.assertEqual(container.name, cont.name)
self.assertEqual(len(objects), len(cont.data))