broadview_collector.py 文件源码

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

项目:broadview-collector 作者: openstack 项目源码 文件源码
def readConfig(self):
        LOG.info("broadview_collector: readConfig")
        try:
            cfg = ConfigParser.ConfigParser()
            cfg.read("/etc/broadviewcollector.conf")
            x = cfg.get("plugins", "publishers")
            self._publisherNames = [y.strip() for y in x.split(',')]
            LOG.info("publishers {}".format(self._publisherNames))
            self._searchpath = []
            try:
                x = cfg.get("plugins", "searchpath")
                self._searchpath = [y.strip() for y in x.split(',')]
            except:
                LOG.info("plugin searchpath missing or malformed")

            if not self._searchpath or len(self._searchpath) == 0:
                self._searchpath = ["broadview_collector.plugins"]
            else:
                self._searchpath.append("broadview_collector.plugins")
            LOG.info("plugin searchpath {}".format(self._searchpath))

            x = cfg.get("plugins", "handlers")
            self._handlerNames = [y.strip() for y in x.split(',')]
            LOG.info("plugin handlers {}".format(self._handlerNames))
            self._ip_address = cfg.get("network", "ip_address")
            self._port = int(cfg.get("network", "port"))

        except:
            LOG.error("Unable to open or read /etc/broadviewcollector.conf")
            exit()
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号