utils.py 文件源码

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

项目:charm-keystone 作者: openstack 项目源码 文件源码
def validate_sectionless_conf(self, file_contents, expected):
        """A crude conf parser.  Useful to inspect configuration files which
        do not have section headers (as would be necessary in order to use
        the configparser).  Such as openstack-dashboard or rabbitmq confs."""
        for line in file_contents.split('\n'):
            if '=' in line:
                args = line.split('=')
                if len(args) <= 1:
                    continue
                key = args[0].strip()
                value = args[1].strip()
                if key in expected.keys():
                    if expected[key] != value:
                        msg = ('Config mismatch.  Expected, actual:  {}, '
                               '{}'.format(expected[key], value))
                        amulet.raise_status(amulet.FAIL, msg=msg)
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号