summaryrefslogtreecommitdiff
path: root/mirrors
diff options
context:
space:
mode:
authorLuke Shumaker <lukeshu@sbcglobal.net>2015-04-16 01:19:04 -0400
committerLuke Shumaker <lukeshu@sbcglobal.net>2015-04-16 01:19:04 -0400
commit7da44456fd05f2ac74355825de7100e46e86449b (patch)
tree036c0732cbfcbbbd0cf9f7b3dd06d3c2ea7e9b09 /mirrors
parent155bf43a28e404f327a7bcff214c22e212627673 (diff)
parent1edc33fd73ba588dea8765cd2d9a936f98d7dc1e (diff)
Merge tag 'release_2015-01-13' into archweb-generic
Version bumps and minor fixes
Diffstat (limited to 'mirrors')
-rw-r--r--mirrors/management/commands/mirrorcheck.py9
1 files changed, 6 insertions, 3 deletions
diff --git a/mirrors/management/commands/mirrorcheck.py b/mirrors/management/commands/mirrorcheck.py
index d2a27bee..8c17c78f 100644
--- a/mirrors/management/commands/mirrorcheck.py
+++ b/mirrors/management/commands/mirrorcheck.py
@@ -96,7 +96,7 @@ def parse_lastsync(log, data):
try:
parsed_time = datetime.utcfromtimestamp(int(data))
log.last_sync = parsed_time.replace(tzinfo=utc)
- except ValueError:
+ except (TypeError, ValueError):
# it is bad news to try logging the lastsync value;
# sometimes we get a crazy-encoded web page.
# if we couldn't parse a time, this is a failure.
@@ -197,8 +197,11 @@ def check_rsync_url(mirror_url, location, timeout):
log.duration = None
else:
logger.debug("success: %s, %.2f", url, log.duration)
- with open(lastsync_path, 'r') as lastsync:
- parse_lastsync(log, lastsync.read())
+ if os.path.exists(lastsync_path):
+ with open(lastsync_path, 'r') as lastsync:
+ parse_lastsync(log, lastsync.read())
+ else:
+ parse_lastsync(log, None)
finally:
if os.path.exists(lastsync_path):
os.unlink(lastsync_path)