Recherche possible sur prise meme si pas dans l'annuaire.

Indique le numero de prise meme sur les machines sans snmp.

darcs-hash:20051007145024-41617-edca216ef609d0f26502645179a1bb4e726e1f7b.gz
This commit is contained in:
pauget 2005-10-07 16:50:24 +02:00
parent 7ae4b258ab
commit 991c627d35

View file

@ -750,7 +750,7 @@ def prise_etat(chbre) :
f+= u', activée, lien non détecté' f+= u', activée, lien non détecté'
except ConversationError: except ConversationError:
# Switch non manageable ou down # Switch non manageable ou down
f = u'info prise non dispo : erreur de communication' f += u', erreur de communication avec le switch'
except : except :
f = u'info prise non dispo : erreur prog' f = u'info prise non dispo : erreur prog'
@ -875,25 +875,26 @@ def __recherche() :
if arg.count('=') == 1 and arg.split('=')[0] == 'prise' : if arg.count('=') == 1 and arg.split('=')[0] == 'prise' :
prise = arg.split('=')[1] prise = arg.split('=')[1]
# Récupération de la chambre # Récupération de la chambre
try : try:
from annuaires import reverse from annuaires import reverse
chbre = reverse(prise[0].lower())[prise[1:]] chbre = reverse(prise[0].lower())[prise[1:]]
except : except KeyError:
try : try:
chbre = reverse(prise[0].lower())[prise[1:]+'-'] chbre = reverse(prise[0].lower())[prise[1:]+'-']
except : except KeyError:
print u"Prise inconnue." chbre=None
if chbre:
if len(chbre) != 1 :
print u"Prise correspondante à plusieurs chambres %s " % ' '.join(chbre)
return return
if len(chbre) != 1 : # On fait la recherche sur la chambre
print u"Prise correspondante à plusieurs prises %s " % ' '.join(chbre) chbre= prise[0] + chbre[0]
return #print u"Recherche sur chambre %s" % chbre
arg = 'chbre=%s' % chbre
# On fait la recherche sur la prise # sinon on ne fait rien et on recherche sur le champ prise
chbre= prise[0] + chbre[0]
#print u"Recherche sur chambre %s" % chbre try:
arg = 'chbre=%s' % chbre
try :
if only_crans : if only_crans :
res = { 'machine' : crans().machines() , 'adherent' : [] , 'club' : [] } res = { 'machine' : crans().machines() , 'adherent' : [] , 'club' : [] }
else : else :