summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTobias Urdin <tobias.urdin@binero.se>2021-03-30 17:49:18 +0200
committerChristian Rohmann <christian.rohmann@inovex.de>2021-07-19 12:04:21 +0200
commit8232ac0385782e8131b071fa1324001c1c429aaf (patch)
treee5eabcfdef74581836df23e00934a8434d970cf2
parentf8d3abd1fc28bf288aabd6f998c4d7462179f26f (diff)
downloadhorizon-8232ac0385782e8131b071fa1324001c1c429aaf.tar.gz
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)
-rw-r--r--openstack_dashboard/api/swift.py2
-rw-r--r--openstack_dashboard/test/unit/api/test_swift.py3
2 files changed, 3 insertions, 2 deletions
diff --git a/openstack_dashboard/api/swift.py b/openstack_dashboard/api/swift.py
index d5af8eadb..f4055e4ea 100644
--- a/openstack_dashboard/api/swift.py
+++ b/openstack_dashboard/api/swift.py
@@ -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:
diff --git a/openstack_dashboard/test/unit/api/test_swift.py b/openstack_dashboard/test/unit/api/test_swift.py
index 5645db3fa..64d38f88d 100644
--- a/openstack_dashboard/test/unit/api/test_swift.py
+++ b/openstack_dashboard/test/unit/api/test_swift.py
@@ -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))