From 432f1752685deecf8ac40ab801cb625353311ec8 Mon Sep 17 00:00:00 2001 From: joey5678 Date: Wed, 28 Jan 2015 10:55:14 +0800 Subject: [PATCH] Modify port value to Integer when create http connection Modify port value to Integer when create http connection. Change-Id: If8e37c6dd4c8b4e15f7bc84aa778f336f33d21b7 --- glancesync/glance/sync/base.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/glancesync/glance/sync/base.py b/glancesync/glance/sync/base.py index 10f513b..2eb2ccd 100644 --- a/glancesync/glance/sync/base.py +++ b/glancesync/glance/sync/base.py @@ -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