manager.py 文件源码

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

项目:virtualbmc 作者: openstack 项目源码 文件源码
def _parse_config(self, domain_name):
        config_path = os.path.join(self.config_dir, domain_name, 'config')
        if not os.path.exists(config_path):
            raise exception.DomainNotFound(domain=domain_name)

        config = configparser.ConfigParser()
        config.read(config_path)

        bmc = {}
        for item in ('username', 'password', 'address', 'domain_name',
                     'libvirt_uri', 'libvirt_sasl_username',
                     'libvirt_sasl_password'):
            try:
                value = config.get(DEFAULT_SECTION, item)
            except configparser.NoOptionError:
                value = None

            bmc[item] = value

        # Port needs to be int
        bmc['port'] = config.getint(DEFAULT_SECTION, 'port')

        return bmc
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号