[gestion/] Kill popen, subprocess ftw
On diminue le nombre de DeprecationWarnings ... darcs-hash:20110307225857-ddb99-74a1452ba6f828f102e8803de1307e8147314887.gz
This commit is contained in:
parent
ecb6e01317
commit
e9242a36af
3 changed files with 9 additions and 8 deletions
|
@ -7,7 +7,7 @@ Copyright (C) Frédéric Pauget
|
|||
Licence : GPLv2
|
||||
"""
|
||||
|
||||
import sys, re, os, tempfile
|
||||
import sys, re, os, tempfile, subprocess
|
||||
|
||||
# Détermination de l'encodage
|
||||
encoding = None
|
||||
|
@ -25,9 +25,9 @@ if encoding == "ANSI_X3.4-1968":
|
|||
encoding = "ISO-8859-15"
|
||||
|
||||
if 'TERM' in os.environ and os.environ['TERM'] != 'unknown':
|
||||
el = os.popen('tput cr ; tput el').read()
|
||||
el = subprocess.Popen('tput cr ; tput el', shell=True, stdout=subprocess.PIPE).stdout.read()
|
||||
else:
|
||||
el = os.popen('tput -Tvt100 cr ; tput -Tvt100 el').read()
|
||||
el = subprocess.Popen('tput -Tvt100 cr ; tput -Tvt100 el', shell=True, stdout=subprocess.PIPE).stdout.read()
|
||||
|
||||
try:
|
||||
stdout_atty = sys.stdout.isatty()
|
||||
|
|
|
@ -10,7 +10,6 @@ Donne la classe switch qui permet d'effectuer les opérations
|
|||
Frédéric PAUGET
|
||||
"""
|
||||
from time import sleep
|
||||
from popen2 import popen3
|
||||
from sys import stderr, path
|
||||
from commands import getstatusoutput
|
||||
from annuaires_pg import chbre_prises, all_switchs
|
||||
|
|
|
@ -56,7 +56,7 @@ from ldap_crans import MachineCrans, MachineWifi, BorneWifi
|
|||
from ldap_crans import Adherent
|
||||
from affich_tools import *
|
||||
import user_tests
|
||||
import popen2, commands
|
||||
import subprocess, commands
|
||||
|
||||
limit_aff_details = 1
|
||||
limit_aff_machines = 15
|
||||
|
@ -939,9 +939,11 @@ def borne_clients_canal(borne) :
|
|||
for clef in ["/etc/wifi/ssh/wifi","/usr/scripts/gestion/clef-wifi"]:
|
||||
if os.path.isfile(clef) and user_tests.isadm():
|
||||
try:
|
||||
wl = popen2.Popen3("ssh -o StrictHostKeyChecking=no -i %s root@%s 'cat /tmp/auth-mac.dump ; echo -n \"CANAL \" ; /usr/sbin/nvram get wl0_channel' 2> /dev/null" % (clef, borne))
|
||||
wl.tochild.close()
|
||||
for line in wl.fromchild.readlines():
|
||||
wl = subprocess.Popen("ssh -o StrictHostKeyChecking=no -i %s root@%s 'cat /tmp/auth-mac.dump ; echo -n \"CANAL \" ; /usr/sbin/nvram get wl0_channel'" % (clef, borne), shell=True, stdin=subprocess.PIPE, stdout=subprocess.PIPE, stderr=subprocess.PIPE, close_fds=True)
|
||||
wl.stdin.close()
|
||||
for line in wl.stdout.readlines():
|
||||
print 'coucou'
|
||||
print line
|
||||
# Chaque ligne est de la forme
|
||||
# 00:11:22:33:44:55 -20
|
||||
line = line.strip().split()
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue