Broken compatibility with python-glanceclient
Affects | Status | Importance | Assigned to | Milestone | |
---|---|---|---|---|---|
Glance Client |
Fix Released
|
Critical
|
Brian Rosmaita | ||
keystoneauth |
Fix Released
|
Undecided
|
Monty Taylor |
Bug Description
After the fix introduced in https:/
It is turned out that python-glanceclient encodes all the default headers before passing it to keystoneauth. The encoding is applied due to:
```
# NOTE(pumaranikar): To avoid bug #1641239, no modification of
# headers should be allowed after encode_headers() is called.
```
See https:/
While processing the request keystoneauth adds it's own headers (e.g. auth token and User-Agent) but doesn't encode or decode anything. As a result, we have a list of headers, some of which are plain strings while others are bytes.
Since v3.5.0 of keystoneauth all the received headers are sorted in _http_log_request (keystoneauth/
```
if headers:
# Sort headers so that testing can work consistently.
for header in sorted(
```
The attempt to sort the headers cause TypeError: unorderable types: bytes() < str().
Changed in keystoneauth: | |
assignee: | Brian Rosmaita (brian-rosmaita) → Monty Taylor (mordred) |
For additional info:
The headers provided by python-glanceclient (token is replaced by a dummy): [('User- Agent', 'python- glanceclient' ), ('X-Auth-Token', 'xxx'), (b'Content-Type', b'application/ octet-stream' )])
```
dict_items(
```
The received traceback: vstorage- ui-backend/ venv/lib64/ python3. 4/site- packages/ python_ glanceclient- 2.9.0-py3. 4.egg/glancecli ent/common/ utils.py" , line 545, in inner wrapped( *args, **kwargs)) vstorage- ui-backend/ venv/lib64/ python3. 4/site- packages/ python_ glanceclient- 2.9.0-py3. 4.egg/glancecli ent/v2/ tasks.py" , line 102, in get client. get(url) vstorage- ui-backend/ venv/lib64/ python3. 4/site- packages/ keystoneauth1- 3.5.0-py3. 4.egg/keystonea uth1/adapter. py", line 304, in get vstorage- ui-backend/ venv/lib64/ python3. 4/site- packages/ python_ glanceclient- 2.9.0-py3. 4.egg/glancecli ent/common/ http.py" , line 335, in request vstorage- ui-backend/ venv/lib64/ python3. 4/site- packages/ keystoneauth1- 3.5.0-py3. 4.egg/keystonea uth1/adapter. py", line 189, in request request( url, method, **kwargs) vstorage- ui-backend/ venv/lib64/ python3. 4/site- packages/ keystoneauth1- 3.5.0-py3. 4.egg/keystonea uth1/session. py", line 732, in request split_loggers) vstorage- ui-backend/ venv/lib64/ python3. 4/site- packages/ keystoneauth1- 3.5.0-py3. 4.egg/keystonea uth1/session. py", line 393, in _http_log_request headers. items() ):
```
Traceback (most recent call last):
File "/usr/libexec/
return RequestIdProxy(
File "/usr/libexec/
resp, body = self.http_
File "/usr/libexec/
return self.request(url, 'GET', **kwargs)
File "/usr/libexec/
**kwargs)
File "/usr/libexec/
return self.session.
File "/usr/libexec/
logger=logger, split_loggers=
File "/usr/libexec/
for header in sorted(
TypeError: unorderable types: bytes() < str()
```