entity.py 文件源码

python
阅读 34 收藏 0 点赞 0 评论 0

项目:nav 作者: UNINETT 项目源码 文件源码
def get_purge_list(self):
        """Returns a  list of entitites that should be purged from the db"""
        to_purge = set(self.missing)
        graph = self._build_dependency_graph()
        if not graph:
            return to_purge
        collected = set(entitykey(e) for e in self.get_managed())
        missing = (miss for miss in self.missing
                   if miss.device is not None and miss in to_purge)
        for miss in missing:
            if miss not in graph:
                self._logger.warning(
                    "missing entity cannot be found in dependency graph, maybe "
                    "the plugin that originally collected it didn't run? : "
                    "%r : %r", miss, graph.nodes())
                continue
            try:
                sub = subtree(graph, miss)
            except nx.NetworkXError as err:
                self._logger.warning(
                    "Ignoring suspicious error during processing of entity "
                    "relationships in ENTITY-MIB::entPhysicalTable: %s", err)
                continue
            # filter away any missing entity whose index appears to have
            # been re-used
            not_replaced = [n for n in sub if entitykey(n) not in collected]
            to_purge.difference_update(not_replaced)
        return to_purge
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号