in cacheck/ccadb/db.py [0:0]
def _rec_get_ca_children(self, ca_id, parent_ca_ids, depth):
"""
Recursively get CA children and build tree of dicts
NB: This does not get any cert ids, only CAs
:param ca_id: int(CA_ID)
:param parent_ca_ids: A set of previously seen CA IDs. Ignore a child
CA if it is already contained in the tree.
"""
ca_tree = {}
if depth == 0:
return ca_tree, {}
elif depth == -1:
pass
elif depth > 0:
depth = depth - 1
else:
raise RuntimeError("Logic error in recursive CA tree builder. depth is < -1")
##get children
ccas, ca_cn_map = self.get_child_ca_ids(ca_id)
for cca_id in ccas:
#skip child ca ids already included
if cca_id in parent_ca_ids:
continue
if not isinstance(cca_id, type(None)):
parent_ca_ids.add(cca_id)
cca_tree, cca_cn_map = self._rec_get_ca_children(cca_id, parent_ca_ids, depth)
ca_tree[cca_id] = cca_tree
ca_cn_map.update(cca_cn_map)
return ca_tree, ca_cn_map