[ldap_crans/gest_crans] Ajout d'une fonction de log, et interversion de l'affectation d'une ip, et des tests sur la mac, sinon l'ipv6 ça juste marche pas
This commit is contained in:
parent
5406f3fcd4
commit
559583654b
2 changed files with 11 additions and 6 deletions
|
@ -204,6 +204,10 @@ def is_actif(sanction):
|
|||
fin = int(bl[1])
|
||||
return debut < now and fin > now
|
||||
|
||||
def log(contenu):
|
||||
with open('/tmp/crans.log', 'a') as f:
|
||||
f.writelines(contenu)
|
||||
f.writelines('\n')
|
||||
|
||||
def format_mac(mac):
|
||||
"""
|
||||
|
@ -2856,14 +2860,15 @@ Contactez nounou si la MAC est bien celle d'une carte.""", 3)
|
|||
|
||||
# Lock de la mac
|
||||
self.lock('macAddress', mac)
|
||||
net = self.netv6()
|
||||
try:
|
||||
self._set('macAddress', [mac])
|
||||
if self.netv6() != 'special':
|
||||
self.ipv6(ip6tools.mac_to_ipv6(self.netv6(), netaddr.EUI(mac)))
|
||||
self.ipv6(ip6tools.mac_to_ipv6(net, netaddr.EUI(mac)))
|
||||
else:
|
||||
self.ipv6(config.ipv6_machines_speciales[int(self.rid())])
|
||||
except:
|
||||
raise ValueError('La correspondance MAC <-> EUID64 a planté. Tapez PEB et son entourage.')
|
||||
raise ValueError('La correspondance MAC <-> EUID64 a planté. Tapez PEB et son entourage. (net : %s, mac : %s, ' % (net, mac))
|
||||
return mac
|
||||
|
||||
def __host_alias(self, champ, new):
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue