From d8c2414b4d58620da89625c7b78aca97c48bc164 Mon Sep 17 00:00:00 2001 From: Daniel STAN Date: Sat, 12 Jul 2014 12:49:32 +0200 Subject: [PATCH] ips_of_metadata: gestion vlan adm ET adh --- etc/python/ip.py | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/etc/python/ip.py b/etc/python/ip.py index e5f36ae..e443194 100644 --- a/etc/python/ip.py +++ b/etc/python/ip.py @@ -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'