summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorNarayan Desai <desai@mcs.anl.gov>2007-03-20 16:14:08 +0000
committerNarayan Desai <desai@mcs.anl.gov>2007-03-20 16:14:08 +0000
commitbb46d39030b25543b06a0a9c455e2dcf12626a2a (patch)
treefd28ad7a53eb295f62f5e00a7fd7bc2bbb47f4d9 /src
parent9a7398a1a51acbad31ed4aba0b2051a63c91f6d6 (diff)
downloadbcfg2-bb46d39030b25543b06a0a9c455e2dcf12626a2a.tar.gz
bcfg2-bb46d39030b25543b06a0a9c455e2dcf12626a2a.tar.bz2
bcfg2-bb46d39030b25543b06a0a9c455e2dcf12626a2a.zip
Set tlslite xmlrpc timeout up to 90 sec
git-svn-id: https://svn.mcs.anl.gov/repos/bcfg/trunk/bcfg2@2950 ce84e21b-d406-0410-9b95-82705330c041
Diffstat (limited to 'src')
-rw-r--r--src/lib/Client/Proxy.py36
1 files changed, 35 insertions, 1 deletions
diff --git a/src/lib/Client/Proxy.py b/src/lib/Client/Proxy.py
index 6140d1f90..2e6d50ae8 100644
--- a/src/lib/Client/Proxy.py
+++ b/src/lib/Client/Proxy.py
@@ -1,12 +1,46 @@
'''Cobalt proxy provides client access to cobalt components'''
__revision__ = '$Revision$'
-import logging, socket, time, xmlrpclib, ConfigParser
+import logging, socket, time, xmlrpclib, ConfigParser, httplib
from Bcfg2.tlslite.integration.XMLRPCTransport import XMLRPCTransport
+from Bcfg2.tlslite.integration.HTTPTLSConnection import HTTPTLSConnection
+from Bcfg2.tlslite.TLSConnection import TLSConnection
import Bcfg2.tlslite.errors
#FIXME need to reimplement _binadaddress support for XMLRPCTransport
+class MyHTTPTLSConnection(HTTPTLSConnection):
+ def connect(self):
+ sock = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
+ if hasattr(sock, 'settimeout'):
+ sock.settimeout(90)
+ sock.connect((self.host, self.port))
+
+ #Use a TLSConnection to emulate a socket
+ self.sock = TLSConnection(sock)
+
+ #When httplib closes this, close the socket
+ self.sock.closeSocket = True
+ self._handshake(self.sock)
+
+class MyXMLRPCTransport(XMLRPCTransport):
+ def make_connection(self, host):
+ # create a HTTPS connection object from a host descriptor
+ host, extra_headers, x509 = self.get_host_info(host)
+ http = MyHTTPTLSConnection(host, None,
+ self.username, self.password,
+ self.sharedKey,
+ self.certChain, self.privateKey,
+ self.checker.cryptoID,
+ self.checker.protocol,
+ self.checker.x509Fingerprint,
+ self.checker.x509TrustList,
+ self.checker.x509CommonName,
+ self.settings)
+ http2 = httplib.HTTP()
+ http2._setup(http)
+ return http2
+
class CobaltComponentError(Exception):
pass