oo_filters.py 文件源码

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

项目:origin-ci-tool 作者: openshift 项目源码 文件源码
def oo_image_tag_to_rpm_version(version, include_dash=False):
        """ Convert an image tag string to an RPM version if necessary
            Empty strings and strings that are already in rpm version format
            are ignored. Also remove non semantic version components.

            Ex. v3.2.0.10 -> -3.2.0.10
                v1.2.0-rc1 -> -1.2.0
        """
        if not isinstance(version, basestring):
            raise errors.AnsibleFilterError("|failed expects a string or unicode")
        if version.startswith("v"):
            version = version[1:]
            # Strip release from requested version, we no longer support this.
            version = version.split('-')[0]

        if include_dash and version and not version.startswith("-"):
            version = "-" + version

        return version
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号