8
0
Fork 0
mirror of https://gitlab2.federez.net/re2o/re2o synced 2024-12-23 15:33:45 +00:00

FIx temporaires pour l'autodetect

This commit is contained in:
Gabriel Detraz 2017-09-11 03:37:01 +02:00 committed by root
parent 49f911cf4b
commit 56f391d7d8
2 changed files with 8 additions and 10 deletions

View file

@ -284,11 +284,11 @@ def decide_vlan_and_register_macauth(switch_id, port_number, mac_address):
elif not room_user.first().has_access(): elif not room_user.first().has_access():
return (sw_name, 'Machine inconnue et adhérent non cotisant', VLAN_NOK) return (sw_name, 'Machine inconnue et adhérent non cotisant', VLAN_NOK)
else: else:
result, reason = user.autoregister_machine(mac_address) result, reason = room_user.first().autoregister_machine(mac_address, ipv4.first())
if result: if result:
return (sw_name, 'Access Ok, Capture de la mac...', VLAN_OK) return (sw_name, 'Access Ok, Capture de la mac...', VLAN_OK)
else: else:
return (sw_name, u'Erreur dans le register mac %s' % reason, VLAN_NOK) return (sw_name, u'Erreur dans le register mac %s' % reason + unicode(mac_address), VLAN_NOK)
elif not interface.first().is_active: elif not interface.first().is_active:
return (sw_name, 'Machine non active / adherent non cotisant', VLAN_NOK) return (sw_name, 'Machine non active / adherent non cotisant', VLAN_NOK)
else: else:

View file

@ -474,14 +474,12 @@ class User(AbstractBaseUser):
machine_parent.clean() machine_parent.clean()
domain = Domain() domain = Domain()
domain.name = self.pseudo.replace('_','-').lower() + str(all_machines.count()) domain.name = self.pseudo.replace('_','-').lower() + str(all_machines.count())
with transaction.atomic(), reversion.create_revision(): machine_parent.save()
machine_parent.save() interface_cible.machine = machine_parent
interface_cible.machine = machine_parent interface_cible.save()
interface_cible.save() domain.interface_parent = interface_cible
domain.interface_parent = interface_cible domain.clean()
domain.clean() domain.save()
domain.save()
reversion.set_comment("Autocapture radius")
except Exception as e: except Exception as e:
return False, e return False, e
return True, "Ok" return True, "Ok"