summaryrefslogtreecommitdiffstats
path: root/src/lib
diff options
context:
space:
mode:
authorChris St. Pierre <chris.a.st.pierre@gmail.com>2012-01-13 08:20:49 -0500
committerChris St. Pierre <chris.a.st.pierre@gmail.com>2012-01-13 08:20:49 -0500
commitf32c180d4c28ddffb235a24cb49763141e0e1b97 (patch)
treeb83f5bb6b7a4f251b10fcb2893656ffda95a0df1 /src/lib
parent001fb4c7e6ef4110aa5330213ac2d12ed62c6292 (diff)
downloadbcfg2-f32c180d4c28ddffb235a24cb49763141e0e1b97.tar.gz
bcfg2-f32c180d4c28ddffb235a24cb49763141e0e1b97.tar.bz2
bcfg2-f32c180d4c28ddffb235a24cb49763141e0e1b97.zip
avoid traceback for socket.error during proxy
Diffstat (limited to 'src/lib')
-rw-r--r--src/lib/Proxy.py9
1 files changed, 3 insertions, 6 deletions
diff --git a/src/lib/Proxy.py b/src/lib/Proxy.py
index 9d0197798..c340cadda 100644
--- a/src/lib/Proxy.py
+++ b/src/lib/Proxy.py
@@ -22,10 +22,12 @@ import socket
try:
import ssl
SSL_LIB = 'py26_ssl'
+ SSL_ERROR = ssl.SSLError
except ImportError:
from M2Crypto import SSL
import M2Crypto.SSL.Checker
SSL_LIB = 'm2crypto'
+ SSL_ERROR = SSL.SSLError
import sys
@@ -305,14 +307,9 @@ class XMLRPCTransport(xmlrpclib.Transport):
self.send_user_agent(h)
self.send_content(h, request_body)
- if SSL_LIB == 'py26_ssl':
- catch = ssl.SSLError
- elif SSL_LIB == 'm2crypto':
- catch = SSL.SSLError
-
try:
errcode, errmsg, headers = h.getreply()
- except catch:
+ except (socket.error, SSL_ERROR):
err = sys.exc_info()[1]
raise ProxyError(xmlrpclib.ProtocolError(host + handler,
408,