mirror of https://github.com/openspug/spug
U 改进获取主机扩展信息兼容性
parent
ac7d78240c
commit
365d484007
|
@ -202,6 +202,8 @@ def fetch_host_extend(ssh):
|
||||||
code, out = ssh.exec_command_raw('hostname -I')
|
code, out = ssh.exec_command_raw('hostname -I')
|
||||||
if code == 0:
|
if code == 0:
|
||||||
for ip in out.strip().split():
|
for ip in out.strip().split():
|
||||||
|
if len(ip) > 15: # ignore ipv6
|
||||||
|
continue
|
||||||
if ipaddress.ip_address(ip).is_global:
|
if ipaddress.ip_address(ip).is_global:
|
||||||
if len(public_ip_address) < 10:
|
if len(public_ip_address) < 10:
|
||||||
public_ip_address.add(ip)
|
public_ip_address.add(ip)
|
||||||
|
|
Loading…
Reference in New Issue