def now(self): return Timestamp.now(self.offset)
if not os.path.isdir(args.rpki_rtr_dir): os.makedirs(args.rpki_rtr_dir) os.chdir(args.rpki_rtr_dir) except OSError, e: logging.critical(str(e)) sys.exit(1) for version in sorted(rpki.rtr.server.PDU.version_map.iterkeys(), reverse=True): logging.debug("# Generating updates for protocol version %d", version) old_ixfrs = glob.glob("*.ix.*.v%d" % version) current = rpki.rtr.server.read_current(version)[0] cutoff = Timestamp.now(-(24 * 60 * 60)) for f in glob.iglob("*.ax.v%d" % version): t = Timestamp(int(f.split(".")[0])) if t < cutoff and t != current: logging.debug("# Deleting old file %s, timestamp %s", f, t) os.unlink(f) pdus = rpki.rtr.generator.AXFRSet.parse_rcynic(args.rcynic_dir, version, args.scan_roas, args.scan_routercerts) if pdus == rpki.rtr.generator.AXFRSet.load_current(version): logging.debug("# No change, new serial not needed") continue pdus.save_axfr() for axfr in glob.iglob("*.ax.v%d" % version): if axfr != pdus.filename():
try: if not os.path.isdir(args.rpki_rtr_dir): os.makedirs(args.rpki_rtr_dir) os.chdir(args.rpki_rtr_dir) except OSError, e: logging.critical(str(e)) sys.exit(1) for version in sorted(rpki.rtr.server.PDU.version_map.iterkeys(), reverse = True): logging.debug("# Generating updates for protocol version %d", version) old_ixfrs = glob.glob("*.ix.*.v%d" % version) current = rpki.rtr.server.read_current(version)[0] cutoff = Timestamp.now(-(24 * 60 * 60)) for f in glob.iglob("*.ax.v%d" % version): t = Timestamp(int(f.split(".")[0])) if t < cutoff and t != current: logging.debug("# Deleting old file %s, timestamp %s", f, t) os.unlink(f) pdus = rpki.rtr.generator.AXFRSet.parse_rcynic(args.rcynic_dir, version, args.scan_roas, args.scan_routercerts) if pdus == rpki.rtr.generator.AXFRSet.load_current(version): logging.debug("# No change, new serial not needed") continue pdus.save_axfr() for axfr in glob.iglob("*.ax.v%d" % version): if axfr != pdus.filename(): pdus.save_ixfr(rpki.rtr.generator.AXFRSet.load(axfr)) pdus.mark_current(args.force_zero_nonce)