diff options
author | Rob Austein <sra@hactrn.net> | 2009-05-10 21:48:10 +0000 |
---|---|---|
committer | Rob Austein <sra@hactrn.net> | 2009-05-10 21:48:10 +0000 |
commit | 8d7e1692a4206408e88189709de9a66bc4723f35 (patch) | |
tree | f2ca39de6115aff2928a41d56b7bdc88b9543deb /rpkid/rpki/rpki_engine.py | |
parent | 3031f6ecc8ee5a3e137f835ea5e7f6d40ce99f34 (diff) |
Unroll ca.delete()
svn path=/rpkid/rpki/left_right.py; revision=2420
Diffstat (limited to 'rpkid/rpki/rpki_engine.py')
-rw-r--r-- | rpkid/rpki/rpki_engine.py | 18 |
1 files changed, 14 insertions, 4 deletions
diff --git a/rpkid/rpki/rpki_engine.py b/rpkid/rpki/rpki_engine.py index 97fae857..e983fa90 100644 --- a/rpkid/rpki/rpki_engine.py +++ b/rpkid/rpki/rpki_engine.py @@ -307,7 +307,7 @@ class ca_obj(rpki.sql.sql_persistant): rpki.up_down.issue_pdu.query(parent, self, ca_detail, done, eb) - def delete(self, parent): + def delete(self, parent, callback): """The list of current resource classes received from parent does not include the class corresponding to this CA, so we need to delete it (and its little dog too...). @@ -318,10 +318,20 @@ class ca_obj(rpki.sql.sql_persistant): CA, then finally delete this CA itself. """ + def fail(e): + rpki.log.warn("Could not delete CA %r, skipping: %s" % (self, e)) + callback() + + def done(): + self.sql_delete() + callback() + repository = parent.repository() - for ca_detail in self.ca_details(): - ca_detail.delete(self, repository) - self.sql_delete() + + def loop(iterator, ca_detail): + ca_detail.delete(self, repository, iterator, fail) + + rpki.async.iterator(self.ca_details(), loop, done) def next_serial_number(self): """Allocate a certificate serial number.""" |