Légère optimisation de la recherche d'un rid libre
This commit is contained in:
parent
6534241650
commit
1dde48ff32
1 changed files with 5 additions and 2 deletions
|
@ -3273,11 +3273,14 @@ Contactez nounou si la MAC est bien celle d'une carte.""", 3)
|
|||
v6 = False
|
||||
if ip == '<automatique>' and not self.rid():
|
||||
for plage in plage_rid:
|
||||
rid_pris = [int(elem[1]['rid'][0]) for elem in self.conn.search_ext_s(self.base_dn, ldap.SCOPE_SUBTREE, "(&(rid>=%s)(rid<=%s))" % (plage[0], plage[1]))]
|
||||
rid_pris = [
|
||||
int(elem[1]['rid'][0])
|
||||
for elem in self.conn.search_ext_s(self.base_dn, ldap.SCOPE_SUBTREE, "(&(rid>=%s)(rid<=%s))" % (plage[0], plage[1]))
|
||||
]
|
||||
#print sorted(rid_pris)
|
||||
# Par defaut la plage est pas v6 (cf bornes/bornes v6)
|
||||
v6 = False
|
||||
for rid in range(plage[0],plage[1] + 1):
|
||||
for rid in xrange(plage[0], plage[1] + 1):
|
||||
if rid not in rid_pris:
|
||||
# On verifie que l'ip se termine pas par 0 ou 255 et que il y a une ipv4 dispo (on sort si on est dans une plage v6)
|
||||
if not ridtools.Rid(rid=rid).ipv4_dispo:
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue