diff options
author | Nicolás Reynolds <fauno@kiwwwi.com.ar> | 2011-02-09 11:17:53 -0300 |
---|---|---|
committer | Nicolás Reynolds <fauno@kiwwwi.com.ar> | 2011-02-09 11:17:53 -0300 |
commit | c1d3642b275775ea560a553436d3d86ccdbf8c39 (patch) | |
tree | 1efa6af6eda3cc3b6b05eabc95464b5a3ca7a093 /mirrors | |
parent | 4eda10d77f9a74f962343406ea54e72649787844 (diff) | |
parent | f1e476373a602327a5d23d2f92c7dc30ce2891fd (diff) |
Merge branch 'master' of git://projects.archlinux.org/archweb
Diffstat (limited to 'mirrors')
-rw-r--r-- | mirrors/management/commands/mirrorcheck.py | 12 | ||||
-rw-r--r-- | mirrors/management/commands/mirrorresolv.py | 6 |
2 files changed, 10 insertions, 8 deletions
diff --git a/mirrors/management/commands/mirrorcheck.py b/mirrors/management/commands/mirrorcheck.py index d7aad4e2..44d2b364 100644 --- a/mirrors/management/commands/mirrorcheck.py +++ b/mirrors/management/commands/mirrorcheck.py @@ -68,7 +68,7 @@ def parse_rfc3339_datetime(time_string): def check_mirror_url(mirror_url): url = mirror_url.url + 'lastsync' - logger.info("checking URL %s" % url) + logger.info("checking URL %s", url) log = MirrorLog(url=mirror_url, check_time=datetime.utcnow()) try: start = time.time() @@ -86,7 +86,7 @@ def check_mirror_url(mirror_url): # it is bad news to try logging the lastsync value; # sometimes we get a crazy-encoded web page. logger.info("attempting to parse generated lastsync file" - " from mirror %s" % url) + " from mirror %s", url) parsed_time = parse_rfc3339_datetime(data) log.last_sync = parsed_time @@ -95,7 +95,7 @@ def check_mirror_url(mirror_url): log.error = "Could not parse time from lastsync" log.is_success = False log.duration = end - start - logger.debug("success: %s, %.2f" % (url, log.duration)) + logger.debug("success: %s, %.2f", url, log.duration) except urllib2.HTTPError, e: if e.code == 404: # we have a duration, just not a success @@ -103,7 +103,7 @@ def check_mirror_url(mirror_url): log.duration = end - start log.is_success = False log.error = str(e) - logger.debug("failed: %s, %s" % (url, log.error)) + logger.debug("failed: %s, %s", url, log.error) except urllib2.URLError, e: log.is_success = False log.error = e.reason @@ -116,11 +116,11 @@ def check_mirror_url(mirror_url): log.error = "Connection timed out." elif isinstance(e.reason, socket.error): log.error = e.reason.args[1] - logger.debug("failed: %s, %s" % (url, log.error)) + logger.debug("failed: %s, %s", url, log.error) except socket.timeout, e: log.is_success = False log.error = "Connection timed out." - logger.debug("failed: %s, %s" % (url, log.error)) + logger.debug("failed: %s, %s", url, log.error) return log diff --git a/mirrors/management/commands/mirrorresolv.py b/mirrors/management/commands/mirrorresolv.py index bcb24a52..8cbd51a3 100644 --- a/mirrors/management/commands/mirrorresolv.py +++ b/mirrors/management/commands/mirrorresolv.py @@ -43,13 +43,15 @@ def resolve_mirrors(): for mirrorurl in MirrorUrl.objects.filter(mirror__active=True): try: hostname = urlparse(mirrorurl.url).hostname - logger.debug("resolving %3i (%s)" % (mirrorurl.id, hostname)) + logger.debug("resolving %3i (%s)", mirrorurl.id, hostname) info = socket.getaddrinfo(hostname, None, 0, socket.SOCK_STREAM) families = [x[0] for x in info] mirrorurl.has_ipv4 = socket.AF_INET in families mirrorurl.has_ipv6 = socket.AF_INET6 in families + logger.debug("%s: v4: %s v6: %s", hostname, + mirrorurl.has_ipv4, mirrorurl.has_ipv6) mirrorurl.save() except socket.error, e: - logger.warn("error resolving %s: %s" % (hostname, e)) + logger.warn("error resolving %s: %s", hostname, e) # vim: set ts=4 sw=4 et: |