From de186b4393ce25cdfb51b1c3240e0326c85890cf Mon Sep 17 00:00:00 2001 From: Rob Austein Date: Thu, 18 Apr 2013 23:30:56 +0000 Subject: Teach rpkic and yamltest about Ghostbusters records. svn path=/trunk/; revision=5300 --- rpkid/rpki/irdb/zookeeper.py | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) (limited to 'rpkid/rpki/irdb') diff --git a/rpkid/rpki/irdb/zookeeper.py b/rpkid/rpki/irdb/zookeeper.py index bd32caf1..6b72a8a8 100644 --- a/rpkid/rpki/irdb/zookeeper.py +++ b/rpkid/rpki/irdb/zookeeper.py @@ -918,6 +918,27 @@ class Zookeeper(object): max_prefixlen = int(p.max_prefixlen)) + @django.db.transaction.commit_on_success + def load_ghostbuster_requests(self, filename, parent = None): + """ + Whack IRDB to match ghostbusters.vcard. + + This accepts one or more vCards from a file. + """ + + self.resource_ca.ghostbuster_requests.filter(parent = parent).delete() + + vcard = [] + + for line in open(filename, "r"): + if not vcard and not line.upper().startswith("BEGIN:VCARD"): + continue + vcard.append(line) + if line.upper().startswith("END:VCARD"): + self.resource_ca.ghostbuster_requests.create(vcard = "".join(vcard), parent = parent) + vcard = [] + + def call_rpkid(self, *pdus): """ Issue a call to rpkid, return result. -- cgit v1.2.3