- Parse output HTML for class="error" and give those errors back to the user (done),
then boot them back into configure so they can enter in something different
-- Replace gaierror with a more descriptive name (this is a DNS error)
-
- Pre-emptively check if daemon/scripts-security-upd
is not on scripts-security-upd list (/mit/moira/bin/blanche)
- If you try to do an install on scripts w/o sql, it will sign you up but fail to write
pass
def fetch(host, path, subpath, post=None):
- h = httplib.HTTPConnection(host)
- fullpath = path.rstrip("/") + "/" + subpath.lstrip("/") # to be lenient about input we accept
- if post:
- headers = {"Content-type": "application/x-www-form-urlencoded"}
- h.request("POST", fullpath, urllib.urlencode(post), headers)
- else:
- h.request("GET", fullpath)
- r = h.getresponse()
- data = r.read()
- h.close()
- return data
+ try:
+ # XXX: Special case if it's https; not sure why this data isn't
+ # passed
+ h = httplib.HTTPConnection(host)
+ fullpath = path.rstrip("/") + "/" + subpath.lstrip("/") # to be lenient about input we accept
+ if post:
+ headers = {"Content-type": "application/x-www-form-urlencoded"}
+ h.request("POST", fullpath, urllib.urlencode(post), headers)
+ else:
+ h.request("GET", fullpath)
+ r = h.getresponse()
+ data = r.read()
+ h.close()
+ return data
+ except socket.gaierror as e:
+ if e.errno == socket.EAI_NONAME:
+ raise DNSError(host)
+ else:
+ raise
def mixed_newlines(filename):
"""Returns ``True`` if ``filename`` has mixed newlines."""
another migration process running?
"""
+class DNSError(socket.gaierror):
+ errno = socket.EAI_NONAME
+ #: Hostname that could not resolve name
+ host = None
+ def __init__(self, host):
+ self.host = host
+ def __str__(self):
+ return """
+
+ERROR: Could not resolve hostname %s.
+""" % self.host