auth.py: enregistre mac *et/ou* rid

This commit is contained in:
Daniel STAN 2015-02-26 18:16:13 +01:00
parent 132636e7f9
commit ea4e86dbdd

View file

@ -209,8 +209,8 @@ def get_fresh_rid(machine):
machine.conn.lockholder.purge(lockId)
@use_ldap_admin
def register_mac(data, machine, conn):
"""Enregistre la mac actuelle sur une machine donnée."""
def register_machine(data, machine, conn):
"""Enregistre la mac actuelle et/ou assigne le rid sur une machine donnée."""
# TODO lc_ldap devrait posséder une fonction pour passer en rw depuis un ro
if 'w' not in machine.mode:
machine = conn.search(dn=machine.dn, scope=ldap.SCOPE_BASE, mode='rw')[0]
@ -427,8 +427,8 @@ def decide_vlan(data, is_wifi, conn):
proprio = machine.proprio()
# Avant de continuer, on assigne la mac à la machine candidat
if '<automatique>' in machine['macAddress']:
register_mac(data, machine)
if '<automatique>' in machine['macAddress'] or not machine['rid']:
register_machine(data, machine)
if not machine['ipHostNumber']:
decision = 'v6only', u'No IPv4'