mirror of
https://gitlab2.federez.net/re2o/re2o
synced 2024-08-20 06:03:40 +00:00
Fix problème de variables globales réassignées en fonctions
This commit is contained in:
parent
1a134e31ae
commit
ea7e50f532
1 changed files with 8 additions and 4 deletions
|
@ -263,6 +263,7 @@ def check_user_machine_and_register(nas_type, username, mac_address):
|
||||||
|
|
||||||
def decide_vlan_and_register_switch(nas, nas_type, port_number, mac_address):
|
def decide_vlan_and_register_switch(nas, nas_type, port_number, mac_address):
|
||||||
# Get port from switch and port number
|
# Get port from switch and port number
|
||||||
|
extra_log = ""
|
||||||
if not nas:
|
if not nas:
|
||||||
return ('?', u'Nas inconnu', VLAN_OK)
|
return ('?', u'Nas inconnu', VLAN_OK)
|
||||||
|
|
||||||
|
@ -275,10 +276,13 @@ def decide_vlan_and_register_switch(nas, nas_type, port_number, mac_address):
|
||||||
port = port.first()
|
port = port.first()
|
||||||
# Si un vlan a été précisé, on l'utilise pour VLAN_OK
|
# Si un vlan a été précisé, on l'utilise pour VLAN_OK
|
||||||
if port.vlan_force:
|
if port.vlan_force:
|
||||||
VLAN_OK = int(port.vlan_force.vlan_id)
|
DECISION_VLAN = int(port.vlan_force.vlan_id)
|
||||||
|
extra_log = u"Force sur vlan " + str(DECISION_VLAN)
|
||||||
|
else:
|
||||||
|
DECISION_VLAN = VLAN_OK
|
||||||
|
|
||||||
if port.radius == 'NO':
|
if port.radius == 'NO':
|
||||||
return (sw_name, u"Pas d'authentification sur ce port", VLAN_OK)
|
return (sw_name, u"Pas d'authentification sur ce port" + extra_log, DECISION_VLAN)
|
||||||
|
|
||||||
if port.radius == 'BLOQ':
|
if port.radius == 'BLOQ':
|
||||||
return (sw_name, u'Port desactive', VLAN_NOK)
|
return (sw_name, u'Port desactive', VLAN_NOK)
|
||||||
|
@ -312,12 +316,12 @@ def decide_vlan_and_register_switch(nas, nas_type, port_number, mac_address):
|
||||||
else:
|
else:
|
||||||
result, reason = room_user.first().autoregister_machine(mac_address, nas_type)
|
result, reason = room_user.first().autoregister_machine(mac_address, nas_type)
|
||||||
if result:
|
if result:
|
||||||
return (sw_name, u'Access Ok, Capture de la mac...', VLAN_OK)
|
return (sw_name, u'Access Ok, Capture de la mac...' + extra_log, DECISION_VLAN)
|
||||||
else:
|
else:
|
||||||
return (sw_name, u'Erreur dans le register mac %s' % reason + unicode(mac_address), 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, u'Machine non active / adherent non cotisant', VLAN_NOK)
|
return (sw_name, u'Machine non active / adherent non cotisant', VLAN_NOK)
|
||||||
else:
|
else:
|
||||||
return (sw_name, u'Machine OK', VLAN_OK)
|
return (sw_name, u'Machine OK' + extra_log, DECISION_VLAN)
|
||||||
|
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue