summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSteve Martinelli <stevemar@ca.ibm.com>2015-12-14 03:30:00 -0500
committerSteve Martinelli <stevemar@ca.ibm.com>2015-12-14 12:23:44 -0500
commit74a6a81ae9d2c92575f4be531aa88fbd5dae9819 (patch)
tree18f8de067eb8fd9e62735316c25b277adae001c4
parent1ee5191cec53df588d51a7cee31cfe9cf3a57a1b (diff)
downloadpython-openstackclient-74a6a81ae9d2c92575f4be531aa88fbd5dae9819.tar.gz
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
-rw-r--r--openstackclient/api/object_store_v1.py2
-rw-r--r--openstackclient/tests/api/test_object_store_v1.py5
-rw-r--r--releasenotes/notes/bug_1525805-122e6ce0c3cd4945.yaml5
3 files changed, 10 insertions, 2 deletions
diff --git a/openstackclient/api/object_store_v1.py b/openstackclient/api/object_store_v1.py
index ab75a78c..d9f130bc 100644
--- a/openstackclient/api/object_store_v1.py
+++ b/openstackclient/api/object_store_v1.py
@@ -570,6 +570,6 @@ class APIv1(api.BaseAPI):
# OSC commands
properties = {}
for k, v in six.iteritems(headers):
- if k.startswith(header_tag):
+ if k.lower().startswith(header_tag):
properties[k[len(header_tag):]] = v
return properties
diff --git a/openstackclient/tests/api/test_object_store_v1.py b/openstackclient/tests/api/test_object_store_v1.py
index 992bf261..8cc3a927 100644
--- a/openstackclient/tests/api/test_object_store_v1.py
+++ b/openstackclient/tests/api/test_object_store_v1.py
@@ -157,6 +157,7 @@ class TestContainer(TestObjectAPIv1):
'container': 'qaz',
'object_count': '1',
'bytes_used': '577',
+ 'properties': {'Owner': FAKE_ACCOUNT},
}
self.requests_mock.register_uri(
'HEAD',
@@ -309,6 +310,7 @@ class TestObject(TestObjectAPIv1):
'etag': 'qaz',
'x-container-meta-owner': FAKE_ACCOUNT,
'x-object-meta-wife': 'Wilma',
+ 'x-object-meta-Husband': 'fred',
'x-tra-header': 'yabba-dabba-do',
}
resp = {
@@ -319,7 +321,8 @@ class TestObject(TestObjectAPIv1):
'content-length': '577',
'last-modified': '20130101',
'etag': 'qaz',
- 'properties': {'wife': 'Wilma'},
+ 'properties': {'wife': 'Wilma',
+ 'Husband': 'fred'},
}
self.requests_mock.register_uri(
'HEAD',
diff --git a/releasenotes/notes/bug_1525805-122e6ce0c3cd4945.yaml b/releasenotes/notes/bug_1525805-122e6ce0c3cd4945.yaml
new file mode 100644
index 00000000..444b6378
--- /dev/null
+++ b/releasenotes/notes/bug_1525805-122e6ce0c3cd4945.yaml
@@ -0,0 +1,5 @@
+---
+fixes:
+ - |
+ Fix case sensitivity when showing object-store properties.
+ [Bug `1525805 <https://bugs.launchpad.net/bugs/1525805>`_]