machine.py 文件源码

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

项目:two1-python 作者: 21dotco 项目源码 文件源码
def status_networking(self):
        """ Get status of ZeroTier One service.
        """
        try:
            if "ps_zerotier.sh" not in self.docker_ssh("ls", stderr=subprocess.DEVNULL).decode().split("\n"):
                subprocess.check_output(["docker-machine",
                                         "scp",
                                         os.path.join(
                                             os.path.dirname(os.path.abspath(__file__)),
                                             "util",
                                             "scripts",
                                             "ps_zerotier.sh"),
                                         "21:~/ps_zerotier.sh"])
            self.docker_ssh("chmod a+x ~/ps_zerotier.sh", stderr=subprocess.DEVNULL)
            processes = self.docker_ssh("./ps_zerotier.sh", stderr=subprocess.DEVNULL).decode().split("\n")
            for process in processes:
                if process.find("zerotier-one -d") != -1:
                    return True
            return False
        except subprocess.CalledProcessError:
            return False
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号