whos sur une borne renvoie les clients de la borne (est-ce bien
thique ?) uniquement sur nectaris pour le moment darcs-hash:20041015153018-d1718-4dbbd23ba5def71d735a38a16c71591d00c33df1.gz
This commit is contained in:
parent
1d91fba698
commit
1c5fe8a10d
1 changed files with 31 additions and 1 deletions
|
@ -45,9 +45,10 @@ try:
|
|||
except:
|
||||
pass
|
||||
|
||||
from ldap_crans import is_actif , crans_ldap, ann_scol, crans
|
||||
from ldap_crans import is_actif , crans_ldap, ann_scol, crans, hostname
|
||||
from affich_tools import *
|
||||
from hptools import sw_chbre
|
||||
import popen2
|
||||
|
||||
limit_aff_details = 1
|
||||
limit_aff_historique = 4
|
||||
|
@ -426,6 +427,19 @@ def machine_details(machine) :
|
|||
else:
|
||||
f += coul(u'borne éteinte','rouge')
|
||||
f += '\n'
|
||||
# S'il y a des clients, on les liste
|
||||
clients = borne_clients(machine.nom())
|
||||
if clients:
|
||||
f += coul(u'Clients : \n','gras')
|
||||
for client in clients:
|
||||
# On va chercher le nom correspondant à l'adresse MAC
|
||||
res = base.search("mac=%s" % client)['machine']
|
||||
if not res:
|
||||
client_nom = '????'
|
||||
else:
|
||||
client_nom = ", ".join([x.nom() for x in res])
|
||||
f += u'\t%s (%s)\n' % (client, client_nom)
|
||||
|
||||
|
||||
if aff_ipsec and machine.ipsec() :
|
||||
f += coul(u'Clef IPsec : ','gras') + machine.ipsec()
|
||||
|
@ -579,6 +593,22 @@ def borne_etat(borne) :
|
|||
except:
|
||||
return False
|
||||
|
||||
def borne_clients(borne) :
|
||||
"""Renvoie la liste des adresses MAC associées à la borne"""
|
||||
macs = []
|
||||
# Sur nectaris uniquement dans un premier temps
|
||||
if hostname == 'nectaris':
|
||||
try:
|
||||
wl = popen2.Popen3("ssh -o StrictHostKeyChecking=no -i /etc/wifi/ssh/wifi root@%s wl assoclist 2> /dev/null" % borne)
|
||||
wl.tochild.close()
|
||||
for line in wl.fromchild.readlines():
|
||||
# Chaque ligne est de la forme
|
||||
# assoclist 00:11:22:33:44:55
|
||||
macs.append(line.split(" ")[1].strip())
|
||||
except:
|
||||
pass
|
||||
return macs
|
||||
|
||||
def prise_etat(chbre) :
|
||||
f = ''
|
||||
try :
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue