iptables_raw.py 文件源码

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

项目:dcos-ansible-packet 作者: ContainerSolutions 项目源码 文件源码
def _check_compatibility(self):
        from distutils.version import StrictVersion
        cmd = [self.bins['iptables'], '--version']
        rc, stdout, stderr = Iptables.module.run_command(cmd, check_rc=False)
        if rc == 0:
            result = re.search(r'^ip6tables\s+v(\d+\.\d+)\.\d+$', stdout)
            if result:
                version = result.group(1)
                # CentOS 5 ip6tables (v1.3.x) doesn't support comments,
                # which means it cannot be used with this module.
                if StrictVersion(version) < StrictVersion('1.4'):
                    Iptables.module.fail_json(msg="This module isn't compatible with ip6tables versions older than 1.4.x")
        else:
            Iptables.module.fail_json(msg="Could not fetch iptables version! Is iptables installed?")

    # Read rules from the json state file and return a dict.
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号