-
Notifications
You must be signed in to change notification settings - Fork 926
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[LIBCLOUD-716] Fix port type error #533
Conversation
Thanks, the change looks good to me. It looks like things would only break if the API or auth service was on a non-standard port, right? |
On a related note - some tests would also be good. |
Thinking more about it - this code has been like that since pretty much the beginning and I worked with many OpenStack installations which ran on a custom port and I never encountered any issues. Curious if we have introduced a regression somewhere recently or there is something else going on (e.g. some Python versions don't accept a string). |
My libcloud runs on the following python version: in an ubuntu 14.04 system. My devstack is from a latest version. I am using the following snippet to run openstack operations which fail, as described in the above jira issue link.
My python2.7 socket.py create_connection complains that port is not an int or str. Looking into this, I can see that it receives a port from unicode type and that is probably the reason it fails. Adding traces in _tuple_from_url to print netloc and its type, I can see that netloc for the nova service is unicode. 1.2.3.4:5000, <type 'str'> From looking into libcloud code it seems to me that port can be a string if it is fetched out from a url (_tuple_from_url). Is that correct? I would like to raise a question:
I am curious whether the 2nd port assignment is somewhat redundant. |
This one line change, fixed my issue and I had to adapt only three openstack tests (committed here) for the unit tests to pass. |
Hi, |
@aviweit Thanks for the additional details and clarification. I added some additional casting to int inside the |
Closes #533 Signed-off-by: Tomaz Muraus <tomaz@tomaz.me>
The merged fix works for me. I tested with libcloud managing OpenStack, Amazon and Softlayer. I am closing this PR. Thanks. |
Great. Thanks. |
Fixes issue: https://issues.apache.org/jira/browse/LIBCLOUD-716