From b37920c96e64a4c93e1dab45b8990eb986bcbab0 Mon Sep 17 00:00:00 2001 From: Michael Fenn Date: Fri, 1 Nov 2013 22:44:41 -0400 Subject: Proxy: Catch SSL errors and retry The SSL library can throw an exception during the XMLRPC method call. There is no explicit except statement for this type of exception so they get raised up and abort the client's processing. This patch catches the exception so that normal retry processing occurs. Typical traceback: Traceback (most recent call last): File "/usr/sbin/bcfg2", line 29, in ? sys.exit(main()) File "/usr/sbin/bcfg2", line 26, in main return Client(setup).run() File "/usr/lib/python2.4/site-packages/Bcfg2/Client/Client.py", line 256, in run rawconfig = self.get_config(times=times).decode('utf-8') File "/usr/lib/python2.4/site-packages/Bcfg2/Client/Client.py", line 225, in get_config self.run_probes(times=times) File "/usr/lib/python2.4/site-packages/Bcfg2/Client/Client.py", line 151, in run_probes probes = Bcfg2.Client.XML.XML(str(self.proxy.GetProbes())) File "/usr/lib/python2.4/site-packages/Bcfg2/Proxy.py", line 81, in __call__ return _orig_Method.__call__(self, *args) File "/usr/lib64/python2.4/xmlrpclib.py", line 1096, in __call__ return self.__send(self.__name, args) File "/usr/lib64/python2.4/xmlrpclib.py", line 1383, in __request verbose=self.__verbose File "/usr/lib/python2.4/site-packages/Bcfg2/Proxy.py", line 331, in request return self.parse_response(response) File "/usr/lib64/python2.4/xmlrpclib.py", line 1255, in parse_response return self._parse_response(file, None) File "/usr/lib64/python2.4/xmlrpclib.py", line 1276, in _parse_response response = file.read(1024) File "/usr/lib64/python2.4/httplib.py", line 480, in read s = self.fp.read(amt) File "/usr/lib64/python2.4/socket.py", line 303, in read data = self._sock.recv(recv_size) File "/usr/lib64/python2.4/site-packages/M2Crypto/SSL/Connection.py", line 217, in read return self._read_bio(size) File "/usr/lib64/python2.4/site-packages/M2Crypto/SSL/Connection.py", line 202, in _read_bio return m2.ssl_read(self.ssl, size, self._timeout) M2Crypto.SSL.SSLError: (104, 'Connection reset by peer') --- src/lib/Bcfg2/Proxy.py | 3 +++ 1 file changed, 3 insertions(+) (limited to 'src/lib/Bcfg2/Proxy.py') diff --git a/src/lib/Bcfg2/Proxy.py b/src/lib/Bcfg2/Proxy.py index f6db66a93..83c5107d1 100644 --- a/src/lib/Bcfg2/Proxy.py +++ b/src/lib/Bcfg2/Proxy.py @@ -103,6 +103,9 @@ class RetryMethod(xmlrpclib._Method): except ProxyError: err = sys.exc_info()[1] msg = err + except SSL_ERROR: + err = sys.exc_info()[1] + msg = err except: raise etype, err = sys.exc_info()[:2] -- cgit v1.2.3-1-g7c22 From 593c22c23b2cfbd988ed824a5adc961880bbe7c4 Mon Sep 17 00:00:00 2001 From: Michael Fenn Date: Sat, 2 Nov 2013 09:43:17 -0400 Subject: Don't re-raise unknown exceptions per stpierre --- src/lib/Bcfg2/Proxy.py | 4 ---- 1 file changed, 4 deletions(-) (limited to 'src/lib/Bcfg2/Proxy.py') diff --git a/src/lib/Bcfg2/Proxy.py b/src/lib/Bcfg2/Proxy.py index 83c5107d1..34080da6b 100644 --- a/src/lib/Bcfg2/Proxy.py +++ b/src/lib/Bcfg2/Proxy.py @@ -103,11 +103,7 @@ class RetryMethod(xmlrpclib._Method): except ProxyError: err = sys.exc_info()[1] msg = err - except SSL_ERROR: - err = sys.exc_info()[1] - msg = err except: - raise etype, err = sys.exc_info()[:2] msg = "Unknown failure: %s (%s)" % (err, etype.__name__) if msg: -- cgit v1.2.3-1-g7c22