[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]

extras-buildsys/common CommonErrors.py, NONE, 1.1 FileDownloader.py, 1.5, 1.6 SSLCommon.py, 1.4, 1.5



Author: dcbw

Update of /cvs/fedora/extras-buildsys/common
In directory cvs-int.fedora.redhat.com:/tmp/cvs-serv19730/common

Modified Files:
	FileDownloader.py SSLCommon.py 
Added Files:
	CommonErrors.py 
Log Message:
2005-06-17  Dan Williams <dcbw redhat com>

    * common/CommonErrors.py
      server/client_manager.py
      common/SSLCommon.py
      common/FileDownloader.py

    * server/BuildJob.py
        - better check for unspawned jobs
        - Add a '/' to SRPM URLs that clients download to protect against CONFIG.py
            errors
        - Mark the repo as invalid after we copy RPMs to it

    * server/BuildMaster.py
        - Only run createrepo when the repository has actually changed

    * server/client_manager.py
       - Fix bug that caused jobs to simultaneously get started on all clients
           that supported an architecture




--- NEW FILE CommonErrors.py ---
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
# GNU Library General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
#
# Copyright 2005 Dan Williams <dcbw redhat com> and Red Hat, Inc.

from M2Crypto import SSL
import socket


def canIgnoreSSLError(e):
    """
    Identify common network errors that mean we cannot connect to the server
    """

    # This is a bit complicated by the fact that different versions of
    # M2Crypto & OpenSSL seem to return different error codes for the
    # same type of error
    if type(e) == type(SSL.SSLError):
        if e[0] == 104:     # Connection refused
            return True
        elif e[0] == 111:   # Connection reset by peer
            return True
        elif e[0] == 54:    # Connection reset by peer
            return True
        elif e[0] == "no certificate returned":
            return True
        elif e[0] == "wrong version number":
            return True
        elif e[0] == "unexpected eof":
            return True

    return False


def canIgnoreSocketError(e):
    """
    Identify common network errors that mean we cannot connect to the server
    """

    if type(e) == type(socket.error):
        if e[0] == 111:     # Connection refused
            return True
        elif e[0] == 104:   # Connection reset by peer
            return True
        elif e[0] == 61:
            return True

    return False


Index: FileDownloader.py
===================================================================
RCS file: /cvs/fedora/extras-buildsys/common/FileDownloader.py,v
retrieving revision 1.5
retrieving revision 1.6
diff -u -r1.5 -r1.6
--- FileDownloader.py	16 Jun 2005 21:22:51 -0000	1.5
+++ FileDownloader.py	19 Jun 2005 02:47:53 -0000	1.6
@@ -22,6 +22,7 @@
 import os
 import HTTPSURLopener
 from M2Crypto import SSL
+import CommonErrors
 
 
 def get_base_filename_from_url(url, legal_exts):
@@ -95,7 +96,7 @@
                 result = self._opener.retrieve(self._url, target_file)
             except SSL.SSLError, e:
                 # Don't traceback on dropped connections or timeouts
-                if e[0] == 104 or e[0] == 111:
+                if CommonErrors.canIgnoreSSLError(e):
                     result = None
             if result:
                 success = True


Index: SSLCommon.py
===================================================================
RCS file: /cvs/fedora/extras-buildsys/common/SSLCommon.py,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -r1.4 -r1.5
--- SSLCommon.py	17 Jun 2005 16:43:52 -0000	1.4
+++ SSLCommon.py	19 Jun 2005 02:47:53 -0000	1.5
@@ -16,6 +16,7 @@
 
 from M2Crypto import SSL
 import os
+import CommonErrors
 
 
 def quietCallback(self, *args):
@@ -58,13 +59,7 @@
             if self.verify_request(request, client_address):
                 self.process_request(request, client_address)
         except SSL.SSLError, e:
-            if e.args[0] == "no certificate returned":
-                pass
-            elif e.args[0] == "wrong version number":
-                pass
-            elif e.args[0] == "unexpected eof":
-                pass
-            elif e.args[0] == 54:   # Connection reset by peer
+            if CommonErrors.canIgnoreSSLError(e):
                 pass
             else:
                 self.handle_error(request, client_address)


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]