diff --git a/gestion/affich_tools.py b/gestion/affich_tools.py index 63e12b00..1fea9248 100644 --- a/gestion/affich_tools.py +++ b/gestion/affich_tools.py @@ -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() diff --git a/gestion/hptools.py b/gestion/hptools.py index b24ae0b2..b050a5a2 100644 --- a/gestion/hptools.py +++ b/gestion/hptools.py @@ -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 diff --git a/gestion/whos.py b/gestion/whos.py index afa5e507..f3d7f8a1 100644 --- a/gestion/whos.py +++ b/gestion/whos.py @@ -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()