diff --git a/gestion/gen_confs/switchs2.py b/gestion/gen_confs/switchs2.py index 41c8d741..b38dff0e 100755 --- a/gestion/gen_confs/switchs2.py +++ b/gestion/gen_confs/switchs2.py @@ -156,10 +156,17 @@ class Port(object): """Renvoie V_TAGGED, V_UNTAGGED ou V_NO suivant le ``vlan`` (str) demandé""" if self.servers: - if vlan == 'adm': - return V_UNTAGGED + hosts = [unicode(h) for serv in self.servers for h in serv['host']] + if all(host.endswith('.adm.crans.org') for host in hosts): + if vlan == 'adm': + return V_UNTAGGED + else: + return V_NO else: - return V_NO + if vlan == 'adherent': + return V_UNTAGGED + else: + return V_TAGGED if self.uplink: # TODO retirer ce hack dégueux: tous les switchs devraient tout # tagguer, même le vlan adhérent