def connect_market(self, client, market):
try:
zt_device_address = json.loads(self.docker_ssh("sudo ./zerotier-cli info -j",
stderr=subprocess.DEVNULL).decode())["address"]
response = client.join(market, zt_device_address)
if response.ok:
network_id = response.json().get("networkid")
self.docker_ssh("sudo ./zerotier-cli join %s" % network_id, stderr=subprocess.DEVNULL)
if self.wait_for_zt_confirmation():
pass
except exceptions.ServerRequestError as e:
if e.status_code == 400:
logger.info(uxstring.UxString.invalid_network)
else:
raise e
except subprocess.CalledProcessError as e:
logger.info(str(e))
time.sleep(10) # wait for interface to come up
return
评论列表
文章目录