switchs2: une mac = plusieurs machines

This commit is contained in:
Daniel STAN 2015-01-16 12:15:44 +01:00
parent 4992818761
commit b1da0c15e4

View file

@ -354,12 +354,14 @@ def check_conf_ldap(hostname):
if th_prises_set and pr_prise not in th_prises_set: if th_prises_set and pr_prise not in th_prises_set:
print(" Aucune machine de chbre. Candidats: %r" % th_prises_set) print(" Aucune machine de chbre. Candidats: %r" % th_prises_set)
else: else:
machines = []
for mac in set(port.seen_macs): for mac in set(port.seen_macs):
res = ldap.search(u'macAddress=%s' % mac) res = ldap.search(u'macAddress=%s' % mac)
if not res: if not res:
print(" Unknown mac %s" % mac) print(" Unknown mac %s" % mac)
continue continue
machine = res[0] machines += res
for machine in machines:
owner = machine.proprio() owner = machine.proprio()
if isinstance(owner, ldap_classes.AssociationCrans): if isinstance(owner, ldap_classes.AssociationCrans):
the = unicode(machine.get('prise', ['N/A'])[0]) the = unicode(machine.get('prise', ['N/A'])[0])