diff options
author | Michael Elkins <melkins@tislabs.com> | 2013-04-01 20:40:53 +0000 |
---|---|---|
committer | Michael Elkins <melkins@tislabs.com> | 2013-04-01 20:40:53 +0000 |
commit | e6a8ae4ca901ff460fc5ae25e36c7c4b6484a308 (patch) | |
tree | 404355953c2732f5d8f6ca893263611948891d94 /rpkid | |
parent | 6fe725b135875542f7ecc5c57e0453a1743873c7 (diff) |
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
Diffstat (limited to 'rpkid')
-rw-r--r-- | rpkid/rpki/gui/app/check_expired.py | 16 |
1 files changed, 15 insertions, 1 deletions
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 |