[wifi/bornes.py] Utilisation de subprocess.Popen

darcs-hash:20120210120223-28565-6eda2ef1c67e05f01ae0d325cd0b89d852aaa48a.gz
This commit is contained in:
Daniel STAN 2012-02-10 13:02:23 +01:00
parent 1cdc041bcc
commit 75d94c25a9

View file

@ -11,6 +11,7 @@
La sortie est la sortie de `uname -v` sur chaque borne."""
import sys, os, commands, re, time
from subprocess import Popen, PIPE
from optparse import OptionParser
LOG = "/var/log/wifi/wifi.log"
@ -37,10 +38,10 @@ def bornes():
def ssh_exec(host, cmd):
"""Execute une commande en ssh sur une machine et renvoie le résultat"""
(stdin, stdout, stderr) = os.popen3("ssh -T -x -o BatchMode=yes -o ConnectTimeout=5 -o StrictHostKeyChecking=no -l root -i /usr/scripts/gestion/clef-wifi %(host)s %(cmd)s" % locals())
stdin.close()
stderr.close()
return stdout
p = Popen("ssh -T -x -o BatchMode=yes -o ConnectTimeout=5 -o StrictHostKeyChecking=no -l root -i /usr/scripts/gestion/clef-wifi %(host)s %(cmd)s" % locals(), shell=True, stdin=PIPE, stdout=PIPE, stderr=PIPE)
p.stdin.close()
p.stderr.close()
return p.stdout
def bornes_canal():
names = bornes()