From b1da0c15e465e06ccda84dd8bca9341baf40334f Mon Sep 17 00:00:00 2001 From: Daniel STAN Date: Fri, 16 Jan 2015 12:15:44 +0100 Subject: [PATCH] switchs2: une mac = plusieurs machines --- gestion/gen_confs/switchs2.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/gestion/gen_confs/switchs2.py b/gestion/gen_confs/switchs2.py index b38dff0e..3cb95f7b 100755 --- a/gestion/gen_confs/switchs2.py +++ b/gestion/gen_confs/switchs2.py @@ -354,12 +354,14 @@ def check_conf_ldap(hostname): if th_prises_set and pr_prise not in th_prises_set: print(" Aucune machine de chbre. Candidats: %r" % th_prises_set) else: + machines = [] for mac in set(port.seen_macs): res = ldap.search(u'macAddress=%s' % mac) if not res: print(" Unknown mac %s" % mac) continue - machine = res[0] + machines += res + for machine in machines: owner = machine.proprio() if isinstance(owner, ldap_classes.AssociationCrans): the = unicode(machine.get('prise', ['N/A'])[0])