formation.py 文件源码

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

项目:bay 作者: eventbrite 项目源码 文件源码
def resolve_links(self):
        """
        Resolves any links that are still names to instances from the formation
        """
        for alias, target in list(self.links.items()):
            # If it's a string, it's come from an introspection process where we couldn't
            # resolve into an instance at the time (as not all of them were around)
            if isinstance(target, str):
                try:
                    target = self.formation[target]
                except KeyError:
                    # We don't error here as that would prevent you stopping orphaned containers;
                    # instead, we delete the link and warn the user. The deleted link means `up` will recreate it
                    # if it's orphaned.
                    del self.links[alias]
                    warnings.warn("Could not resolve link {} to an instance for {}".format(target, self.name))
                else:
                    self.links[alias] = target
            elif isinstance(target, ContainerInstance):
                pass
            else:
                raise ValueError("Invalid link value {}".format(repr(target)))
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号