Catch name resolution errors coming from the socket module.

442650
This commit is contained in:
Rob Crittenden
2008-05-13 10:59:37 -04:00
parent b1cc4199fa
commit 3daa94ccc0
18 changed files with 72 additions and 0 deletions

View File

@@ -33,6 +33,7 @@ try:
import krbV import krbV
import ldap import ldap
import errno import errno
import socket
except ImportError: except ImportError:
print >> sys.stderr, """\ print >> sys.stderr, """\
There was a problem importing one of the required Python modules. The There was a problem importing one of the required Python modules. The
@@ -198,6 +199,9 @@ except xmlrpclib.ProtocolError, e:
except ipa.ipaerror.IPAError, e: except ipa.ipaerror.IPAError, e:
print "%s" % (e.message) print "%s" % (e.message)
sys.exit(1) sys.exit(1)
except socket.error, e:
print e[1]
print "Re-run with -v flag for more details."
except Exception, e: except Exception, e:
print "%s" % str(e) print "%s" % str(e)
sys.exit(1) sys.exit(1)

View File

@@ -32,6 +32,7 @@ try:
import kerberos import kerberos
import ldap import ldap
import errno import errno
import socket
except ImportError: except ImportError:
print >> sys.stderr, """\ print >> sys.stderr, """\
There was a problem importing one of the required Python modules. The There was a problem importing one of the required Python modules. The
@@ -134,6 +135,9 @@ except xmlrpclib.ProtocolError, e:
except ipa.ipaerror.IPAError, e: except ipa.ipaerror.IPAError, e:
print "%s" % (e.message) print "%s" % (e.message)
sys.exit(1) sys.exit(1)
except socket.error, e:
print e[1]
print "Re-run with -v flag for more details."
except Exception, e: except Exception, e:
print "%s" % str(e) print "%s" % str(e)
sys.exit(1) sys.exit(1)

View File

@@ -35,6 +35,7 @@ try:
import ldap import ldap
import getpass import getpass
import errno import errno
import socket
except ImportError: except ImportError:
print >> sys.stderr, """\ print >> sys.stderr, """\
There was a problem importing one of the required Python modules. The There was a problem importing one of the required Python modules. The
@@ -101,6 +102,9 @@ except xmlrpclib.ProtocolError, e:
except ipa.ipaerror.IPAError, e: except ipa.ipaerror.IPAError, e:
print "%s" % (e.message) print "%s" % (e.message)
sys.exit(1) sys.exit(1)
except socket.error, e:
print e[1]
print "Re-run with -v flag for more details."
except Exception, e: except Exception, e:
print "%s" % str(e) print "%s" % str(e)
sys.exit(1) sys.exit(1)

View File

@@ -33,6 +33,7 @@ try:
import ldap import ldap
import getpass import getpass
import errno import errno
import socket
except ImportError: except ImportError:
print >> sys.stderr, """\ print >> sys.stderr, """\
There was a problem importing one of the required Python modules. The There was a problem importing one of the required Python modules. The
@@ -268,6 +269,9 @@ except xmlrpclib.ProtocolError, e:
except ipa.ipaerror.IPAError, e: except ipa.ipaerror.IPAError, e:
print "%s" % (e.message) print "%s" % (e.message)
sys.exit(1) sys.exit(1)
except socket.error, e:
print e[1]
print "Re-run with -v flag for more details."
except Exception, e: except Exception, e:
print "%s" % str(e) print "%s" % str(e)
sys.exit(1) sys.exit(1)

View File

@@ -28,6 +28,7 @@ try:
import kerberos import kerberos
import copy import copy
import errno import errno
import socket
import ipa.aci import ipa.aci
from ipa import ipaerror from ipa import ipaerror
@@ -140,6 +141,9 @@ except xmlrpclib.ProtocolError, e:
except ipa.ipaerror.IPAError, e: except ipa.ipaerror.IPAError, e:
print "%s" % (e.message) print "%s" % (e.message)
sys.exit(1) sys.exit(1)
except socket.error, e:
print e[1]
print "Re-run with -v flag for more details."
except Exception, e: except Exception, e:
print "%s" % str(e) print "%s" % str(e)
sys.exit(1) sys.exit(1)

View File

@@ -25,6 +25,7 @@ try:
import ipa.config import ipa.config
import ipa.ipautil as ipautil import ipa.ipautil as ipautil
import errno import errno
import socket
import xmlrpclib import xmlrpclib
import kerberos import kerberos
@@ -102,6 +103,9 @@ except xmlrpclib.ProtocolError, e:
except ipa.ipaerror.IPAError, e: except ipa.ipaerror.IPAError, e:
print "%s" % (e.message) print "%s" % (e.message)
sys.exit(1) sys.exit(1)
except socket.error, e:
print e[1]
print "Re-run with -v flag for more details."
except Exception, e: except Exception, e:
print "%s" % str(e) print "%s" % str(e)
sys.exit(1) sys.exit(1)

View File

@@ -30,6 +30,7 @@ try:
import krbV import krbV
import ldap import ldap
import errno import errno
import socket
except ImportError: except ImportError:
print >> sys.stderr, """\ print >> sys.stderr, """\
There was a problem importing one of the required Python modules. The There was a problem importing one of the required Python modules. The
@@ -106,6 +107,9 @@ except xmlrpclib.ProtocolError, e:
except ipa.ipaerror.IPAError, e: except ipa.ipaerror.IPAError, e:
print "%s" % (e.message) print "%s" % (e.message)
sys.exit(1) sys.exit(1)
except socket.error, e:
print e[1]
print "Re-run with -v flag for more details."
except Exception, e: except Exception, e:
print "%s" % str(e) print "%s" % str(e)
sys.exit(1) sys.exit(1)

View File

@@ -25,6 +25,7 @@ try:
import ipa.ipautil as ipautil import ipa.ipautil as ipautil
import ipa.config import ipa.config
import errno import errno
import socket
import xmlrpclib import xmlrpclib
import kerberos import kerberos
@@ -87,6 +88,9 @@ except xmlrpclib.ProtocolError, e:
except ipa.ipaerror.IPAError, e: except ipa.ipaerror.IPAError, e:
print "%s" % (e.message) print "%s" % (e.message)
sys.exit(1) sys.exit(1)
except socket.error, e:
print e[1]
print "Re-run with -v flag for more details."
except Exception, e: except Exception, e:
print "%s" % str(e) print "%s" % str(e)
sys.exit(1) sys.exit(1)

View File

@@ -29,6 +29,7 @@ try:
import sys import sys
import xmlrpclib import xmlrpclib
import kerberos import kerberos
import socket
except ImportError: except ImportError:
print >> sys.stderr, """\ print >> sys.stderr, """\
There was a problem importing one of the required Python modules. The There was a problem importing one of the required Python modules. The
@@ -154,6 +155,9 @@ except xmlrpclib.ProtocolError, e:
except ipa.ipaerror.IPAError, e: except ipa.ipaerror.IPAError, e:
print "%s" % (e.message) print "%s" % (e.message)
sys.exit(1) sys.exit(1)
except socket.error, e:
print e[1]
print "Re-run with -v flag for more details."
except Exception, e: except Exception, e:
print "%s" % str(e) print "%s" % str(e)
sys.exit(1) sys.exit(1)

View File

@@ -29,6 +29,7 @@ try:
import sys import sys
import xmlrpclib import xmlrpclib
import kerberos import kerberos
import socket
except ImportError: except ImportError:
print >> sys.stderr, """\ print >> sys.stderr, """\
There was a problem importing one of the required Python modules. The There was a problem importing one of the required Python modules. The
@@ -102,6 +103,9 @@ except xmlrpclib.ProtocolError, e:
except ipa.ipaerror.IPAError, e: except ipa.ipaerror.IPAError, e:
print "%s" % (e.message) print "%s" % (e.message)
sys.exit(1) sys.exit(1)
except socket.error, e:
print e[1]
print "Re-run with -v flag for more details."
except Exception, e: except Exception, e:
print "%s" % str(e) print "%s" % str(e)
sys.exit(1) sys.exit(1)

View File

@@ -31,6 +31,7 @@ try:
import sys import sys
import xmlrpclib import xmlrpclib
import kerberos import kerberos
import socket
except ImportError: except ImportError:
print >> sys.stderr, """\ print >> sys.stderr, """\
There was a problem importing one of the required Python modules. The There was a problem importing one of the required Python modules. The
@@ -165,6 +166,9 @@ except xmlrpclib.ProtocolError, e:
except ipa.ipaerror.IPAError, e: except ipa.ipaerror.IPAError, e:
print "%s" % (e.message) print "%s" % (e.message)
sys.exit(1) sys.exit(1)
except socket.error, e:
print e[1]
print "Re-run with -v flag for more details."
except Exception, e: except Exception, e:
print "%s" % str(e) print "%s" % str(e)
sys.exit(1) sys.exit(1)

View File

@@ -28,6 +28,7 @@ try:
import xmlrpclib import xmlrpclib
import kerberos import kerberos
import errno import errno
import socket
import ipa.aci import ipa.aci
from ipa import ipaerror from ipa import ipaerror
@@ -119,6 +120,9 @@ except xmlrpclib.ProtocolError, e:
except ipaerror.IPAError, e: except ipaerror.IPAError, e:
print("Delegation list failed: " + str(e)) print("Delegation list failed: " + str(e))
sys.exit(1) sys.exit(1)
except socket.error, e:
print e[1]
print "Re-run with -v flag for more details."
except Exception, e: except Exception, e:
print "%s" % str(e) print "%s" % str(e)
sys.exit(1) sys.exit(1)

View File

@@ -25,6 +25,7 @@ try:
import ipa.config import ipa.config
import ipa.ipautil as ipautil import ipa.ipautil as ipautil
import errno import errno
import socket
import xmlrpclib import xmlrpclib
import kerberos import kerberos
@@ -106,6 +107,9 @@ except xmlrpclib.ProtocolError, e:
except ipa.ipaerror.IPAError, e: except ipa.ipaerror.IPAError, e:
print "%s" % (e.message) print "%s" % (e.message)
sys.exit(1) sys.exit(1)
except socket.error, e:
print e[1]
print "Re-run with -v flag for more details."
except Exception, e: except Exception, e:
print "%s" % str(e) print "%s" % str(e)
sys.exit(1) sys.exit(1)

View File

@@ -33,6 +33,7 @@ try:
import ldap import ldap
import copy import copy
import errno import errno
import socket
except ImportError: except ImportError:
print >> sys.stderr, """\ print >> sys.stderr, """\
There was a problem importing one of the required Python modules. The There was a problem importing one of the required Python modules. The
@@ -236,6 +237,9 @@ except xmlrpclib.ProtocolError, e:
except ipa.ipaerror.IPAError, e: except ipa.ipaerror.IPAError, e:
print "%s" % (e.message) print "%s" % (e.message)
sys.exit(1) sys.exit(1)
except socket.error, e:
print e[1]
print "Re-run with -v flag for more details."
except Exception, e: except Exception, e:
print "%s" % str(e) print "%s" % str(e)
sys.exit(1) sys.exit(1)

View File

@@ -30,6 +30,7 @@ try:
import kerberos import kerberos
import ldap import ldap
import errno import errno
import socket
except ImportError: except ImportError:
print >> sys.stderr, """\ print >> sys.stderr, """\
There was a problem importing one of the required Python modules. The There was a problem importing one of the required Python modules. The
@@ -227,6 +228,9 @@ except xmlrpclib.ProtocolError, e:
except ipa.ipaerror.IPAError, e: except ipa.ipaerror.IPAError, e:
print "%s" % (e.message) print "%s" % (e.message)
sys.exit(1) sys.exit(1)
except socket.error, e:
print e[1]
print "Re-run with -v flag for more details."
except Exception, e: except Exception, e:
print "%s" % str(e) print "%s" % str(e)
sys.exit(1) sys.exit(1)

View File

@@ -31,6 +31,7 @@ try:
import kerberos import kerberos
import ldap import ldap
import errno import errno
import socket
except ImportError: except ImportError:
print >> sys.stderr, """\ print >> sys.stderr, """\
There was a problem importing one of the required Python modules. The There was a problem importing one of the required Python modules. The
@@ -293,6 +294,9 @@ except xmlrpclib.ProtocolError, e:
except ipa.ipaerror.IPAError, e: except ipa.ipaerror.IPAError, e:
print "%s" % (e.message) print "%s" % (e.message)
sys.exit(1) sys.exit(1)
except socket.error, e:
print e[1]
print "Re-run with -v flag for more details."
except Exception, e: except Exception, e:
print "%s" % str(e) print "%s" % str(e)
sys.exit(1) sys.exit(1)

View File

@@ -30,6 +30,7 @@ try:
import ldap import ldap
import getpass import getpass
import errno import errno
import socket
except ImportError: except ImportError:
print >> sys.stderr, """\ print >> sys.stderr, """\
There was a problem importing one of the required Python modules. The There was a problem importing one of the required Python modules. The
@@ -142,6 +143,9 @@ except xmlrpclib.ProtocolError, e:
except ipa.ipaerror.IPAError, e: except ipa.ipaerror.IPAError, e:
print "%s" % (e.message) print "%s" % (e.message)
sys.exit(1) sys.exit(1)
except socket.error, e:
print e[1]
print "Re-run with -v flag for more details."
except Exception, e: except Exception, e:
print "%s" % str(e) print "%s" % str(e)
sys.exit(1) sys.exit(1)

View File

@@ -29,6 +29,7 @@ try:
import kerberos import kerberos
import errno import errno
import validate import validate
import socket
except ImportError: except ImportError:
print >> sys.stderr, """\ print >> sys.stderr, """\
There was a problem importing one of the required Python modules. The There was a problem importing one of the required Python modules. The
@@ -147,6 +148,9 @@ except xmlrpclib.ProtocolError, e:
except ipa.ipaerror.IPAError, e: except ipa.ipaerror.IPAError, e:
print "%s" % (e.message) print "%s" % (e.message)
sys.exit(1) sys.exit(1)
except socket.error, e:
print e[1]
print "Re-run with -v flag for more details."
except Exception, e: except Exception, e:
print "%s" % str(e) print "%s" % str(e)
sys.exit(1) sys.exit(1)