def _get_market_address(self):
""" Get status of 21mkt network connection.
Returns:
zt_ip (str): ZeroTier IP address.
"""
try:
zt_conf = self.docker_ssh("sudo ./zerotier-cli listnetworks -j", stderr=subprocess.DEVNULL)
if type(zt_conf) == bytes:
zt_conf = zt_conf.decode()
zt_conf_json = json.loads(zt_conf)
for net in zt_conf_json:
if net["name"] == "21mkt":
if net["status"] == "OK":
ip_addrs = net["assignedAddresses"]
for addr in ip_addrs:
potential_match = Two1Machine.ZEROTIER_CLI_IPV6_PATTERN.search(addr)
if potential_match is not None:
return "[%s]" % potential_match.group(0)
return ""
else:
return ""
return ""
except Exception:
return ""
评论列表
文章目录