diff --git a/gestion/ldap_crans.py b/gestion/ldap_crans.py index 118a89e4..f08ee420 100755 --- a/gestion/ldap_crans.py +++ b/gestion/ldap_crans.py @@ -30,7 +30,7 @@ from chgpass import chgpass from affich_tools import coul, prompt from time import sleep,localtime -import ldap_secret +from secrets import ldap_password, ldap_auth_dn random.seed() # On initialise le générateur aléatoire @@ -200,7 +200,7 @@ class crans_ldap : while not ok: try: self.conn = ldap.initialize(uri) - self.conn.bind_s(ldap_secret.auth_dn,ldap_secret.password,ldap.AUTH_SIMPLE) + self.conn.bind_s(ldap_auth_dn,ldap_password,ldap.AUTH_SIMPLE) ok = True except ldap.SERVER_DOWN : nbessais += 1 diff --git a/gestion/whos.py b/gestion/whos.py index 46665aa7..fc45da89 100755 --- a/gestion/whos.py +++ b/gestion/whos.py @@ -47,6 +47,7 @@ except: from ldap_crans import is_actif , crans_ldap, ann_scol, crans from affich_tools import * +from hptools import sw_chbre limit_aff_details = 1 limit_aff_historique = 4 @@ -308,7 +309,10 @@ def adher_details(adher) : f += coul(u'Chambre : ','gras') + u"%s " % chbre prise = adher.prise() if prise : - f += u'(prise %s)' % prise + f += u'(prise %s' % prise + f += prise_etat(chbre) + f += ')' + f += '\n' # Etudes @@ -458,7 +462,9 @@ def club_details(club) : f += coul(u'Local : ','gras') + "%s " % club.local() prise = club.prise() if prise : - f += '(prise %s)' % prise + f += '(prise %s' % prise + f += prise_etat(club.chbre()) + f += ')' f += '\n' # Paiement @@ -555,6 +561,26 @@ def __bases_machines(m) : return t , bl +def prise_etat(chbre) : + f = '' + try : + # On met aussi l'état + conn = sw_chbre(chbre) + result = conn.status() + if result['etat']=='up' : + f += ', ' + coul('machine branchée','vert') + if result['vitesse_max'] == '10Mbps' : + f+= ', ' + coul('prise en 10Mbps','jaune') + elif result['activée'] == 'down' : + f+= ', ' + coul('prise désactivée','rouge') + else : + f+= ', activée, lien non détecté' + except : + # Switch non manageable + pass + + return f + ############################################################################## ## Partie dévolue au système de recherche