diff options
Diffstat (limited to 'rpkid/rpki')
-rw-r--r-- | rpkid/rpki/irdb/zookeeper.py | 21 | ||||
-rw-r--r-- | rpkid/rpki/rpkic.py | 15 |
2 files changed, 36 insertions, 0 deletions
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. diff --git a/rpkid/rpki/rpkic.py b/rpkid/rpki/rpkic.py index 342ed339..c5a9a919 100644 --- a/rpkid/rpki/rpkic.py +++ b/rpkid/rpki/rpkic.py @@ -617,6 +617,21 @@ class main(Cmd): self.zoo.run_rpkid_now() + def do_load_ghostbuster_requests(self, arg): + """ + Load Ghostbuster requests into IRDB from file. + """ + + argv = arg.split() + + if len(argv) != 1: + raise BadCommandSyntax("Expecting filename of Ghostbuster vCard(s)") + + self.zoo.load_ghostbuster_requests(argv[0]) + if self.autosync: + self.zoo.run_rpkid_now() + + def do_synchronize(self, arg): """ Whack daemons to match IRDB. |