Modify port value to Integer when create http connection

Modify port value to Integer when create http connection.

Change-Id: If8e37c6dd4c8b4e15f7bc84aa778f336f33d21b7
This commit is contained in:
joey5678 2015-01-28 10:55:14 +08:00
parent 989caf0c9e
commit 432f175268
1 changed files with 5 additions and 1 deletions

View File

@ -185,7 +185,11 @@ def create_self_restful_client(auth_token):
def _create_restful_client(auth_token, url):
server, port = url.split(':')
conn = httplib.HTTPConnection(server.encode(), port.encode())
try:
port = int(port)
except Exception:
port = 9292
conn = httplib.HTTPConnection(server.encode(), port)
image_service = get_image_servcie()
glance_client = image_service(conn, auth_token)
return glance_client