ips_of_metadata: gestion vlan adm ET adh

This commit is contained in:
Daniel STAN 2014-07-12 12:49:32 +02:00
parent 0baa302692
commit d8c2414b4d

View file

@ -34,9 +34,13 @@ def ips_of_metadata(clients, vlan='adm'):
``clients`` est une liste de ClientMetadata, qui peut être obtenue via
metadata.query.by_groups (ou similaire)
"""
if vlan not in ['adm', 'adh']:
raise NotImplementedError('Seul adm et adh sont supportés')
out = []
for client in clients:
host = client.hostname
if vlan == 'adh':
host = host.split('.', 1)[0] + '.crans.org'
for res in socket.getaddrinfo(host, None, socket.AF_UNSPEC, socket.SOCK_STREAM):
# if res[0] == socket.AF_INET6:
# suffix = '/128'