sequence.py 文件源码

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

项目:DevOps 作者: YoLoveLife 项目源码 文件源码
def sanity_check(self):
        if self.count is None and self.end is None:
            raise AnsibleError( "must specify count or end in with_sequence")
        elif self.count is not None and self.end is not None:
            raise AnsibleError( "can't specify both count and end in with_sequence")
        elif self.count is not None:
            # convert count to end
            if self.count != 0:
                self.end = self.start + self.count * self.stride - 1
            else:
                self.start = 0
                self.end = 0
                self.stride = 0
            del self.count
        if self.stride > 0 and self.end < self.start:
            raise AnsibleError("to count backwards make stride negative")
        if self.stride < 0 and self.end > self.start:
            raise AnsibleError("to count forward don't make stride negative")
        if self.format.count('%') != 1:
            raise AnsibleError("bad formatting string: %s" % self.format)
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号