config.py 文件源码

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

项目:ambassador 作者: datawire 项目源码 文件源码
def load_yaml(self, filename, serialization, k8s=False):
        try:
            # XXX This is a bit of a hack -- yaml.safe_load_all returns a
            # generator, and if we don't use list() here, any exception
            # dealing with the actual object gets deferred             
            ocount = 1

            for obj in yaml.safe_load_all(serialization):
                if k8s:
                    self.prep_k8s(filename, ocount, obj)
                else:
                    self.objects_to_process.append((filename, ocount, obj))
                ocount += 1
        except Exception as e:
            # No sense letting one attribute with bad YAML take down the whole
            # gateway, so post the error but keep any objects we were able to 
            # parse before hitting the error.
            self.filename = filename
            self.ocount = ocount

            self.post_error(RichStatus.fromError("%s: could not parse YAML" % filename))
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号