diff options
author | Rob Austein <sra@hactrn.net> | 2016-01-23 07:42:17 +0000 |
---|---|---|
committer | Rob Austein <sra@hactrn.net> | 2016-01-23 07:42:17 +0000 |
commit | 14bc1c5e11dac9ccae0cbe182ff050a76a506aa9 (patch) | |
tree | 7ed97e74494476cd6c3770b09b8bdb0f3c3bf7ec /rp/rcynic/rcynicng | |
parent | bf7ac5f7bf1ae6a2457a142feb0b105e1bd6810f (diff) |
Tweak logging. Rewrite object checking loop to be a bit clearer.
svn path=/branches/tk705/; revision=6233
Diffstat (limited to 'rp/rcynic/rcynicng')
-rwxr-xr-x | rp/rcynic/rcynicng | 39 |
1 files changed, 18 insertions, 21 deletions
diff --git a/rp/rcynic/rcynicng b/rp/rcynic/rcynicng index 943380b5..cad5ec45 100755 --- a/rp/rcynic/rcynicng +++ b/rp/rcynic/rcynicng @@ -508,7 +508,7 @@ class WalkFrame(object): def __repr__(self): try: - return "<WalkFrame \"{}\" at 0x{:x}".format(self.cer.uri, id(self)) + return "<WalkFrame \"{}\" at 0x{:x}>".format(self.cer.uri, id(self)) except: return "<WalkFrame at 0x{:x}>".format(id(self)) @@ -547,7 +547,7 @@ class WalkFrame(object): def ready(self, wsk): self.trusted = wsk.trusted() - #logger.debug("%r scanning products", self) + logger.debug("%r scanning products", self) # NB: CRL checks on manifest EE certificates deferred until we've picked a CRL. @@ -631,28 +631,24 @@ class WalkFrame(object): continue for obj in fetch_objects(sha256 = digest.encode("hex")): - - # This can't happen as currently written, but we need to handle OBJECT_NOT_FOUND somehow, - # this will do as a placeholder until we figure out how this should work. - - if obj is None: - Status.add(uri, codes.OBJECT_NOT_FOUND) - continue if self.stale_crl: Status.add(uri, codes.TAINTED_BY_STALE_CRL) if self.stale_mft: Status.add(uri, codes.TAINTED_BY_STALE_MANIFEST) - if obj.check(trusted = self.trusted, crl = self.crl): - install_object(obj) - Status.add(uri, codes.OBJECT_ACCEPTED) - if cls is X509 and obj.is_ca: - wsk.push(obj) - return - break - else: + if not obj.check(trusted = self.trusted, crl = self.crl): Status.add(uri, codes.OBJECT_REJECTED) + continue + + install_object(obj) + Status.add(uri, codes.OBJECT_ACCEPTED) + + if cls is not X509 or not obj.is_ca: + break + + wsk.push(obj) + return wsk.pop() @@ -670,7 +666,7 @@ class WalkTask(object): def __repr__(self): try: - return "<WalkTask \"{}\" at 0x{:x}".format(self.wsk[-1].cer.uri, id(self)) + return "<WalkTask \"{}\" at 0x{:x}>".format(self.wsk[-1].cer.uri, id(self)) except: return "<WalkTask at 0x{:x}>".format(id(self)) @@ -1179,14 +1175,15 @@ def worker(meself): # while True: task = yield task_queue.get() + name = repr(task) try: - logger.debug("Worker %s starting %s, queue length %s", meself, task, task_queue.qsize()) + logger.debug("Worker %s starting %s, queue length %s", meself, name, task_queue.qsize()) yield task() except: - logger.exception("Worker %s caught unhandled exception from %s", meself, task) + logger.exception("Worker %s caught unhandled exception from %s", meself, name) finally: task_queue.task_done() - logger.debug("Worker %s finished %s, queue length %s", meself, task, task_queue.qsize()) + logger.debug("Worker %s finished %s, queue length %s", meself, name, task_queue.qsize()) def final_report(): |