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
评论列表
文章目录