image_service.py 文件源码

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

项目:bareon-ironic 作者: openstack 项目源码 文件源码
def validate_href(self, image_href):
        path = urlparse.urlparse(image_href).path.lstrip('/')
        if not path:
            raise exception.ImageRefValidationFailed(
                _("No path specified in swift resource reference: %s. "
                  "Reference must be like swift:container/path")
                % str(image_href))

        container, s, object = path.partition('/')
        try:
            headers = self.client.head_object(container, object)
        except exception.SwiftOperationError as e:
            raise exception.ImageRefValidationFailed(
                _("Cannot fetch %(url)s resource. %(exc)s") %
                dict(url=str(image_href), exc=str(e)))

        return (container, object, headers)
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号