Si la mac est une mac de machine crans, on chercher par prise
This commit is contained in:
parent
8db871f115
commit
fcfdfbced9
1 changed files with 7 additions and 1 deletions
|
@ -47,7 +47,12 @@ def get_chambres(mac):
|
||||||
prise_num = port.name()[1:]
|
prise_num = port.name()[1:]
|
||||||
|
|
||||||
# Ne retourne que la chambre, pas le bâtiment.
|
# Ne retourne que la chambre, pas le bâtiment.
|
||||||
|
try:
|
||||||
chbre_locale = annuaires_pg.reverse(bat, prise_num)[0]
|
chbre_locale = annuaires_pg.reverse(bat, prise_num)[0]
|
||||||
|
# Si pas de correspondance, il s'agit d'une machine crans avec attribu prise ou d'une mac inconnue
|
||||||
|
except IndexError:
|
||||||
|
chbre_locale = prise_num
|
||||||
|
pass
|
||||||
|
|
||||||
# Donc on ajoute le bâtiment
|
# Donc on ajoute le bâtiment
|
||||||
chambres.append("%s%s" % (bat.upper(), chbre_locale))
|
chambres.append("%s%s" % (bat.upper(), chbre_locale))
|
||||||
|
@ -66,6 +71,7 @@ def fetch_db(chambres):
|
||||||
ldap_filter = u""
|
ldap_filter = u""
|
||||||
for chambre in chambres:
|
for chambre in chambres:
|
||||||
ldap_filter += u"(chbre=%s)" % (chambre,)
|
ldap_filter += u"(chbre=%s)" % (chambre,)
|
||||||
|
ldap_filter += u"(prise=%s)" % (chambre,)
|
||||||
|
|
||||||
ldap_filter = u"(|%s)" % (ldap_filter,)
|
ldap_filter = u"(|%s)" % (ldap_filter,)
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue