From e6a8ae4ca901ff460fc5ae25e36c7c4b6484a308 Mon Sep 17 00:00:00 2001 From: Michael Elkins Date: Mon, 1 Apr 2013 20:40:53 +0000 Subject: warn about stale rcynic and bgp data in the nightly expiration cron job. currently set to warn when the last import was more than 12 hours ago. svn path=/trunk/; revision=5250 --- rpkid/rpki/gui/app/check_expired.py | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) (limited to 'rpkid/rpki/gui/app/check_expired.py') diff --git a/rpkid/rpki/gui/app/check_expired.py b/rpkid/rpki/gui/app/check_expired.py index 5f35dbb7..418e031a 100644 --- a/rpkid/rpki/gui/app/check_expired.py +++ b/rpkid/rpki/gui/app/check_expired.py @@ -22,7 +22,7 @@ import logging import datetime from rpki.gui.cacheview.models import Cert -from rpki.gui.app.models import Conf, ResourceCert +from rpki.gui.app.models import Conf, ResourceCert, Timestamp from rpki.gui.app.glue import list_received_resources, get_email_list from rpki.irdb import Zookeeper from rpki.left_right import report_error_elt, list_published_objects_elt @@ -153,6 +153,12 @@ def notify_expired(expire_days=14, from_email=None): if not from_email: from_email = 'root@' + host + # Ensure that the rcynic and routeviews data has been updated recently + # The QuerySet is created here so that it will be cached and reused on each + # iteration of the loop below + t = now - datetime.timedelta(hours=12) # 12 hours + stale_timestamps = Timestamp.objects.filter(ts__lte=t) + # if not arguments are given, query all resource holders qs = Conf.objects.all() @@ -166,6 +172,14 @@ def notify_expired(expire_days=14, from_email=None): errs = StringIO() + # Warn the resource holder admins when data may be out of date + if stale_timestamps: + errs.write('Warning! Stale data from external sources.\n') + errs.write('data source : last import\n') + for obj in stale_timestamps: + errs.write('%-15s: %s\n' % (obj.name, obj.ts)) + errs.write('\n') + check_cert(h.handle, h, errs) # HostedCA is the ResourceHolderCA cross certified under ServerCA, so -- cgit v1.2.3