diff --git a/gestion/config.py b/gestion/config.py index 23e1eb85..bfdc9a86 100644 --- a/gestion/config.py +++ b/gestion/config.py @@ -374,6 +374,7 @@ NETs = { 'serveurs' : [ '138.231.136.0/28' ], 'fil' : [ '138.231.136.0/21' ], 'wifi': [ '138.231.148.0/21' ], 'gratuit': [ '10.42.0.0/16' ], + 'personnel-ens': ['10.2.9.0/24' ], 'all' : [ '138.231.136.0/21', '138.231.148.0/21' ] } diff --git a/gestion/gest_crans.py b/gestion/gest_crans.py index 405ef1e4..f3062c2f 100755 --- a/gestion/gest_crans.py +++ b/gestion/gest_crans.py @@ -196,6 +196,7 @@ def set_etudes(adher): arg += u'"P12" "Université Val de Marne" ' arg += u'"P13" "Université Paris Nord" ' arg += u'"IUFM" "" ' + arg += u'"Personnel ENS" "dans les appartements de l\'ENS"' if not adher.etudes(0): arg += u'"Autre" ""' @@ -245,6 +246,8 @@ def set_etudes(adher): arg += u'"Autre" ""' annul, result = dialog(arg) if annul: return 1 + elif etudes[0] == "Personnel ENS": + result = ['0'] else: result = ['Autre'] @@ -318,7 +321,8 @@ def set_etudes(adher): arg += u'--msgbox "Réponse invalide\n\n\n" 0 0' dialog(arg) return __etudes_annee() - + elif etudes[0] == 'Personnel ENS': + result = ['n/a'] else: result = ['Autre'] @@ -349,7 +353,6 @@ def set_etudes(adher): if step == 3: if __etudes_section(): step -= 1 else: break - try: adher.etudes(etudes) except ValueError, c: @@ -1431,10 +1434,9 @@ 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.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: @@ -2088,7 +2090,7 @@ def menu_principal(): continue else: choix = "Fixe" - elif isinstance(proprio, Club) or not proprio.machines_fixes() or proprio.droits(): + elif isinstance(proprio, Club) or not proprio.machines_fixes() or proprio.droits() or proprio.etudes(0) == 'Personnel ENS': arg = u'--title "Nouvelle machine" ' arg += u'--menu "Type de machine ?" 0 0 0 ' arg += u'"Fixe" "Machine fixe" ' diff --git a/gestion/ldap_crans.py b/gestion/ldap_crans.py index 33e5c726..ae1dbdd9 100755 --- a/gestion/ldap_crans.py +++ b/gestion/ldap_crans.py @@ -2794,7 +2794,10 @@ class Machine(BaseClasseCrans): else: proprio = self.proprietaire() - if not isinstance(proprio, Adherent) or proprio.adherentPayant(): + if proprio.etudes(0) == 'Personnel ENS': + net = config.NETs['personnel-ens'] + pool_ip = lister_ip_dispo('personnel-ens') + elif not isinstance(proprio, Adherent) or proprio.adherentPayant(): try: net = config.NETs['adherents'] pool_ip = lister_ip_dispo('adherents') diff --git a/gestion/numeros_disponibles.py b/gestion/numeros_disponibles.py index 0c8bbe92..6a2b00ef 100755 --- a/gestion/numeros_disponibles.py +++ b/gestion/numeros_disponibles.py @@ -63,11 +63,11 @@ def update_ip(plage, occupees): pool_ip.append(ip) resultat = ''.join('%s\n' % ip for ip in pool_ip if ip not in occupees and not AddrInNet(ip, ancien_vlan_adm)) - - f = open(repertoire + 'ip_' + plage,'w') + + f = open(repertoire + 'ip_' + plage,'w') f.write(resultat) f.close - + def update_ip_fixe(occupees): update_ip('fil', 'ip_fil', occupees)