Skip to content

Commit 74a6a81

Browse files
author
Steve Martinelli
committed
when fetching object store properties use lower()
sometimes properties within object store concepts are stored with mixed case depending on the client used to store said properties. when retrieving properties to 'show' the user, always call lower() on the property in question when comparing it to the reserved values of the swift API. Change-Id: I97ffc715788ca3cd021413124b6945a399465c99 Closes-Bug: 1525805
1 parent 1ee5191 commit 74a6a81

3 files changed

Lines changed: 10 additions & 2 deletions

File tree

openstackclient/api/object_store_v1.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -570,6 +570,6 @@ def _get_properties(self, headers, header_tag):
570570
# OSC commands
571571
properties = {}
572572
for k, v in six.iteritems(headers):
573-
if k.startswith(header_tag):
573+
if k.lower().startswith(header_tag):
574574
properties[k[len(header_tag):]] = v
575575
return properties

openstackclient/tests/api/test_object_store_v1.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -157,6 +157,7 @@ def test_container_show(self):
157157
'container': 'qaz',
158158
'object_count': '1',
159159
'bytes_used': '577',
160+
'properties': {'Owner': FAKE_ACCOUNT},
160161
}
161162
self.requests_mock.register_uri(
162163
'HEAD',
@@ -309,6 +310,7 @@ def test_object_show(self):
309310
'etag': 'qaz',
310311
'x-container-meta-owner': FAKE_ACCOUNT,
311312
'x-object-meta-wife': 'Wilma',
313+
'x-object-meta-Husband': 'fred',
312314
'x-tra-header': 'yabba-dabba-do',
313315
}
314316
resp = {
@@ -319,7 +321,8 @@ def test_object_show(self):
319321
'content-length': '577',
320322
'last-modified': '20130101',
321323
'etag': 'qaz',
322-
'properties': {'wife': 'Wilma'},
324+
'properties': {'wife': 'Wilma',
325+
'Husband': 'fred'},
323326
}
324327
self.requests_mock.register_uri(
325328
'HEAD',
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
fixes:
3+
- |
4+
Fix case sensitivity when showing object-store properties.
5+
[Bug `1525805 <https://bugs.launchpad.net/bugs/1525805>`_]

0 commit comments

Comments
 (0)