summaryrefslogtreecommitdiff
path: root/mirrors/management/commands
diff options
context:
space:
mode:
Diffstat (limited to 'mirrors/management/commands')
-rw-r--r--mirrors/management/commands/mirrorcheck.py12
-rw-r--r--mirrors/management/commands/mirrorresolv.py6
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: