You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@libcloud.apache.org by to...@apache.org on 2016/01/14 19:15:32 UTC
[2/5] libcloud git commit: Fix lint.
Fix lint.
Project: http://git-wip-us.apache.org/repos/asf/libcloud/repo
Commit: http://git-wip-us.apache.org/repos/asf/libcloud/commit/d01e1419
Tree: http://git-wip-us.apache.org/repos/asf/libcloud/tree/d01e1419
Diff: http://git-wip-us.apache.org/repos/asf/libcloud/diff/d01e1419
Branch: refs/heads/friendlier_error_message_on_tls_error
Commit: d01e141993065a7b923947c6c3087b4f3dbea47b
Parents: a9acb7f
Author: Tomaz Muraus <to...@apache.org>
Authored: Thu Jan 14 14:05:09 2016 +0100
Committer: Tomaz Muraus <to...@apache.org>
Committed: Thu Jan 14 14:05:09 2016 +0100
----------------------------------------------------------------------
libcloud/httplib_ssl.py | 19 +++++++++++--------
1 file changed, 11 insertions(+), 8 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/libcloud/blob/d01e1419/libcloud/httplib_ssl.py
----------------------------------------------------------------------
diff --git a/libcloud/httplib_ssl.py b/libcloud/httplib_ssl.py
index a447e50..61f1ac6 100644
--- a/libcloud/httplib_ssl.py
+++ b/libcloud/httplib_ssl.py
@@ -291,22 +291,25 @@ class LibcloudHTTPSConnection(httplib.HTTPSConnection, LibcloudBaseConnection):
self._activate_http_proxy(sock=sock)
try:
- self.sock = ssl.wrap_socket(sock,
- self.key_file,
- self.cert_file,
- cert_reqs=ssl.CERT_REQUIRED,
- ca_certs=self.ca_cert,
- ssl_version=libcloud.security.SSL_VERSION)
+ self.sock = ssl.wrap_socket(
+ sock,
+ self.key_file,
+ self.cert_file,
+ cert_reqs=ssl.CERT_REQUIRED,
+ ca_certs=self.ca_cert,
+ ssl_version=libcloud.security.SSL_VERSION)
except Exception:
exc_cls = sys.exc_info()[0]
e = sys.exc_info()[1]
-
exc_msg = str(e)
+
# Re-throw an exception with a more friendly error message
if 'connection reset by peer' in exc_msg.lower():
ssl_version = libcloud.security.SSL_VERSION
ssl_version = SSL_CONSTANT_TO_TLS_VERSION_MAP[ssl_version]
- msg = UNSUPPORTED_TLS_VERSION_ERROR_MSG % (exc_msg, ssl_version)
+ msg = (UNSUPPORTED_TLS_VERSION_ERROR_MSG %
+ (exc_msg, ssl_version))
+
new_e = exc_cls(msg)
new_e.original_exc = e
raise new_e