ClientException __str__ shows wrong message for HTTP errors
Affects | Status | Importance | Assigned to | Milestone | |
---|---|---|---|---|---|
python-swiftclient |
Fix Released
|
Undecided
|
Unassigned |
Bug Description
2014-02-25 09:40:22.874 | 2014-02-25 09:40:09,765 Account GET failed: http://
in ClientException
def __str__(self):
a = self.msg
b = ''
if self.http_scheme:
b += '%s://' % self.http_scheme
if self.http_host:
b += self.http_host
if self.http_port:
b += ':%s' % self.http_port
in client.py we have:
self.host = self.parsed_
self.port = self.parsed_
and then
raise ClientException
The problem is that conn.host contains netloc from url, which already contains the :port part, so passing and appending self.http_port to error message is not needed.
Changed in python-swiftclient: | |
status: | New → Fix Released |
This is fixed in python-swiftclient 2.1.0 (in commit 2e1a5b7e https:/ /github. com/openstack/ python- swiftclient/ commit/ 2e1a5b7e):
(swiftclient21) vagrant@ saio:~/ swiftclient21$ swift --version vagrant@ saio:~/ swiftclient21$ swift download fakecontainer fakeobject saio:8080/ auth/v1. 0 401 Unauthorized
swift 2.1.0
(swiftclient21)
Auth GET failed: http://
Contrast the old behavior:
(swiftclient203 )vagrant@ saio:~/ swiftclient203$ swift --version )vagrant@ saio:~/ swiftclient203$ swift download fakecontainer fakeobject saio:8080:8080/auth/v1.0 401 Unauthorized
swift 2.0.3
(swiftclient203
Auth GET failed: http://
Although it does occur to me that this could probably have been fixed in a more robust way by changing ClientException and not just the calls to it: as it stands, if some other, future caller passes both the http_host and http_port arguments to the ClientException constructor, the same bug will crop up again.