diff options
author | Paul Karikh <pkarikh@mirantis.com> | 2015-05-25 17:48:45 +0300 |
---|---|---|
committer | Matt Fischer <matt@mattfischer.com> | 2016-03-03 15:46:17 +0000 |
commit | 181e43fe008a1dc6da4ba94de2b0e72912f955ba (patch) | |
tree | aff3f87f7c6e0262aa118a701b5c3dbc492c22f7 | |
parent | 0f652fd6a7c4b90d448210bb16c131515a57b6f5 (diff) | |
download | horizon-181e43fe008a1dc6da4ba94de2b0e72912f955ba.tar.gz |
Add missing content-length header
This patch adds missing content-length header
param into swift_upload_object() method.
Without it object upload handling could be failed
with "411 Length Required" error if Ceph is used
as an object storage.
Change-Id: Id0813806abb36a6f015efd13ec987492a3701476
Closes-Bug: #1352256
(cherry picked from commit 8201d65cf983f9c995dd653953ad1719f6df8459)
-rw-r--r-- | openstack_dashboard/api/swift.py | 1 | ||||
-rw-r--r-- | openstack_dashboard/test/api_tests/swift_tests.py | 5 |
2 files changed, 5 insertions, 1 deletions
diff --git a/openstack_dashboard/api/swift.py b/openstack_dashboard/api/swift.py index b0d0a1897..6f0052076 100644 --- a/openstack_dashboard/api/swift.py +++ b/openstack_dashboard/api/swift.py @@ -287,6 +287,7 @@ def swift_upload_object(request, container_name, object_name, etag = swift_api(request).put_object(container_name, object_name, object_file, + content_length=size, headers=headers) obj_info = {'name': object_name, 'bytes': size, 'etag': etag} diff --git a/openstack_dashboard/test/api_tests/swift_tests.py b/openstack_dashboard/test/api_tests/swift_tests.py index 9bba7c80e..3f244dc30 100644 --- a/openstack_dashboard/test/api_tests/swift_tests.py +++ b/openstack_dashboard/test/api_tests/swift_tests.py @@ -184,16 +184,18 @@ class SwiftApiTests(test.APITestCase): headers = {'X-Object-Meta-Orig-Filename': fake_name} swift_api = self.stub_swiftclient() + test_file = FakeFile() swift_api.put_object(container.name, obj.name, IsA(FakeFile), + content_length=test_file.size, headers=headers) self.mox.ReplayAll() api.swift.swift_upload_object(self.request, container.name, obj.name, - FakeFile()) + test_file) def test_swift_upload_object_without_file(self): container = self.containers.first() @@ -203,6 +205,7 @@ class SwiftApiTests(test.APITestCase): swift_api.put_object(container.name, obj.name, None, + content_length=0, headers={}) self.mox.ReplayAll() |