Gestion switchs par snmp (momo, tu peux rcuprer ta multiprise, c'est trop
chiant d'avoir un interrupteur dessus) darcs-hash:20040919204056-41617-272808c5ebb1c835d15af323318fce5dbb7fdca4.gz
This commit is contained in:
parent
d5cb816c9d
commit
3b643b222b
2 changed files with 30 additions and 4 deletions
|
@ -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
|
||||
|
|
|
@ -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
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue