fix ipv6 sysbus request
This commit is contained in:
parent
6c4bc82319
commit
2cc7d966a0
18
dyndomain
18
dyndomain
@ -44,15 +44,19 @@ def ping(hostname):
|
|||||||
return 0 if ret.returncode else 1
|
return 0 if ret.returncode else 1
|
||||||
|
|
||||||
def get_ipv6_hosts():
|
def get_ipv6_hosts():
|
||||||
r = sysbus.requete('Hosts:getDevices')
|
r = sysbus.requete('Devices:get')
|
||||||
|
|
||||||
ipv6_hosts = dict()
|
ipv6_hosts = dict()
|
||||||
for host in r['status']:
|
for h in r['status']:
|
||||||
hostname=host['hostName']
|
if not 'IPv6Address' in h or not h['IPv6Address']:
|
||||||
for addr in host['addresses']:
|
continue
|
||||||
ipv6_hosts[hostname] = []
|
hostname = h['Name']
|
||||||
if addr['family'] == 'IPv6' and addr['scope'] == 'global':
|
for a in h['IPv6Address']:
|
||||||
ipv6_hosts[hostname].append(addr['ipAddress'])
|
if a['Scope'] != 'global' or a['Status'] != 'reachable':
|
||||||
|
continue
|
||||||
|
if not hostname in ipv6_hosts:
|
||||||
|
ipv6_hosts[hostname] = []
|
||||||
|
ipv6_hosts[hostname].append(a['Address'])
|
||||||
return ipv6_hosts
|
return ipv6_hosts
|
||||||
|
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user