diff --git a/gestion/gest_crans.py b/gestion/gest_crans.py index 421c27cb..043f2e52 100755 --- a/gestion/gest_crans.py +++ b/gestion/gest_crans.py @@ -1501,6 +1501,10 @@ def set_machine(machine): except ValueError, c: err += c.args[0] + '\n' except EnvironmentError, c: err += c.args[0] + '\n' + try: machine.ip(result[2]) + except ValueError, c: err += c.args[0] + '\n' + except EnvironmentError, c: err += c.__str__() + '\n' + except RuntimeError, c: err += c.args[0] + '\n' # Plus d'IP libres, peut-être à traiter differement ? try: machine.mac(result[1]) except ValueError, c: if len(c.args)>1 and c.args[1] == 1 and isadm: @@ -1529,10 +1533,6 @@ def set_machine(machine): err += c.args[0] + '\n' except EnvironmentError, c: err += c.args[0] + '\n' - try: machine.ip(result[2]) - except ValueError, c: err += c.args[0] + '\n' - except EnvironmentError, c: err += c.__str__() + '\n' - except RuntimeError, c: err += c.args[0] + '\n' # Plus d'IP libres, peut-être à traiter differement ? if isadm: try: diff --git a/gestion/ldap_crans.py b/gestion/ldap_crans.py index 6f309348..51b83f7f 100755 --- a/gestion/ldap_crans.py +++ b/gestion/ldap_crans.py @@ -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):