8
0
Fork 0
mirror of https://gitlab2.federez.net/re2o/re2o synced 2024-11-23 20:03:11 +00:00

hotfix : do not fail if vlan policy is not set.

This commit is contained in:
Hugo LEVY-FALK 2018-12-10 21:39:39 +01:00
parent d31a1e6e63
commit 50bdeefdee

View file

@ -385,8 +385,8 @@ def decide_vlan_switch(nas_machine, nas_type, port_number,
sw_name, sw_name,
"Chambre inconnue", "Chambre inconnue",
u'Port inconnu', u'Port inconnu',
RadiusOption('unknown_port_vlan').vlan_id, getattr(RadiusOption.get_cached_value('unknown_port_vlan'), 'vlan_id', None),
RadiusOption('unknown_port')!= RadiusOption.REJECT RadiusOption.get_cached_value('unknown_port')!= RadiusOption.REJECT
) )
# On récupère le profil du port # On récupère le profil du port
@ -438,8 +438,8 @@ def decide_vlan_switch(nas_machine, nas_type, port_number,
sw_name, sw_name,
"Inconnue", "Inconnue",
u'Chambre inconnue', u'Chambre inconnue',
RadiusOption('unknown_room_vlan').vlan_id, getattr(RadiusOption.get_cached_value('unknown_room_vlan'), 'vlan_id', None),
RadiusOption('unknown_room')!= RadiusOption.REJECT RadiusOption.get_cached_value('unknown_room')!= RadiusOption.REJECT
) )
room_user = User.objects.filter( room_user = User.objects.filter(
@ -467,8 +467,8 @@ def decide_vlan_switch(nas_machine, nas_type, port_number,
sw_name, sw_name,
room, room,
u'Utilisateur non cotisant', u'Utilisateur non cotisant',
RadiusOption('non_member_vlan').vlan_id, getattr(RadiusOption.get_cached_value('non_member_vlan'), 'vlan_id', None),
RadiusOption('non_member')!= RadiusOption.REJECT RadiusOption.get_cached_value('non_member')!= RadiusOption.REJECT
) )
# else: user OK, on passe à la verif MAC # else: user OK, on passe à la verif MAC
@ -500,8 +500,8 @@ def decide_vlan_switch(nas_machine, nas_type, port_number,
sw_name, sw_name,
"", "",
u'Machine inconnue', u'Machine inconnue',
RadiusOption('unknown_machine_vlan').vlan_id, getattr(RadiusOption.get_cached_value('unknown_machine_vlan'), 'vlan_id', None),
RadiusOption('unknown_machine')!= RadiusOption.REJECT RadiusOption.get_cached_value('unknown_machine')!= RadiusOption.REJECT
) )
# L'interface a été trouvée, on vérifie qu'elle est active, # L'interface a été trouvée, on vérifie qu'elle est active,
@ -515,16 +515,16 @@ def decide_vlan_switch(nas_machine, nas_type, port_number,
sw_name, sw_name,
room, room,
u'Adherent banni', u'Adherent banni',
RadiusOption('banned_vlan').vlan_id, getattr(RadiusOption.get_cached_value('banned_vlan'), 'vlan_id', None),
RadiusOption('banned')!= RadiusOption.REJECT RadiusOption.get_cached_value('banned')!= RadiusOption.REJECT
) )
if not interface.is_active: if not interface.is_active:
return ( return (
sw_name, sw_name,
room, room,
u'Machine non active / adherent non cotisant', u'Machine non active / adherent non cotisant',
RadiusOption('non_member_vlan').vlan_id, getattr(RadiusOption.get_cached_value('non_member_vlan'), 'vlan_id', None),
RadiusOption('non_member')!= RadiusOption.REJECT RadiusOption.get_cached_value('non_member')!= RadiusOption.REJECT
) )
# Si on choisi de placer les machines sur le vlan # Si on choisi de placer les machines sur le vlan
# correspondant à leur type : # correspondant à leur type :