From 489ba5713d0c29e433eada217a20d45f949502dd Mon Sep 17 00:00:00 2001 From: Tobias Urdin Date: Tue, 30 Mar 2021 17:49:18 +0200 Subject: 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 (cherry picked from commit c87f0e7a90d05f9355bd58165c25561dedae36d5) (cherry picked from commit 8232ac0385782e8131b071fa1324001c1c429aaf) (cherry picked from commit 0d14e7dd190a906895af74ee0e1cbc8037a3aaad) --- openstack_dashboard/api/swift.py | 2 +- openstack_dashboard/test/unit/api/test_swift.py | 3 ++- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/openstack_dashboard/api/swift.py b/openstack_dashboard/api/swift.py index 1d289e6d7..07e81e28a 100644 --- a/openstack_dashboard/api/swift.py +++ b/openstack_dashboard/api/swift.py @@ -177,7 +177,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: diff --git a/openstack_dashboard/test/unit/api/test_swift.py b/openstack_dashboard/test/unit/api/test_swift.py index a91e0249a..66cfe2eeb 100644 --- a/openstack_dashboard/test/unit/api/test_swift.py +++ b/openstack_dashboard/test/unit/api/test_swift.py @@ -46,7 +46,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)) -- cgit v1.2.1