[whokfet] patch de whokfet

Ignore-this: 608c136f00a8783eadbcc8fde6c3d7d6
Parce qu'en lisant un xml (regénéré toutes les 5min), c'est plus rapide.
Et plus besoin de clef-wifi-kfet

darcs-hash:20120623225719-28565-61e146d67ac03564540d16e2f07b403dcff721bd.gz
This commit is contained in:
Daniel STAN 2012-06-24 00:57:19 +02:00
parent e7e0c6f7d6
commit fd4d4a7f9a

View file

@ -11,22 +11,15 @@ from affich_tools import coul, cprint
from whos import aff from whos import aff
from socket import gethostname from socket import gethostname
from os import system from os import system
from subprocess import Popen, PIPE import xml.dom.minidom
def get_wifi_connected_client(): def get_wifi_connected_client():
x=Popen(["ssh","-T", "-i" , "/usr/scripts/gestion/clef-wifi-kfet","-l","root" ,"-x", "-o", "BatchMode=yes", "-o", f = open('/usr/scripts/var/wifi_xml/valhalla.xml','r')
"ConnectTimeout=5", "-o", "StrictHostKeyChecking=no","valhalla.wifi", "/usr/crans/list_clients.sh"], stdout=PIPE) doc = xml.dom.minidom.parse(f)
clients=x.communicate()[0].split("\n") f.close()
macs=[] return [ mac.firstChild.nodeValue for mac in doc.getElementsByTagName('mac') ]
for client in clients:
try:
macs.append(client.split(" ")[1])
except IndexError: pass
return macs
def liste_kfet(): def liste_kfet():
sw = hpswitch('batb-0') sw = hpswitch('batb-0')
db = crans_ldap() db = crans_ldap()
try: try: