From d017ddb44e871f6886883780d956bd357756ca59 Mon Sep 17 00:00:00 2001 From: Daniel STAN Date: Sun, 23 Mar 2014 19:07:16 +0100 Subject: [PATCH] locate_mac: loop sur *tous* les switchs MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit En utilisant le paramètre idoine de all_switchs, plutôt que d'inférer et d'avoir des problèmes de dns. --- gestion/tools/locate_mac.py | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) diff --git a/gestion/tools/locate_mac.py b/gestion/tools/locate_mac.py index 2b37cffa..b2d881a5 100755 --- a/gestion/tools/locate_mac.py +++ b/gestion/tools/locate_mac.py @@ -6,11 +6,12 @@ from time import sleep from os import system import threading -sys.path.append('/usr/scripts/gestion') -from ldap_crans import crans_ldap -import whos -from annuaires_pg import all_switchs -from hptools import hpswitch +if '/usr/scripts' not in sys.path: + sys.path.append('/usr/scripts') +from gestion.ldap_crans import crans_ldap +from gestion import whos +from gestion.annuaires_pg import all_switchs +from gestion.hptools import hpswitch # mise en forme d'une adresse mac def format_mac(unformated_mac): @@ -59,8 +60,8 @@ def info_machine(mac): # interrogation des switchs en parallele def trace_machine(mac, affiche_uplinks=False): tableau = [] - - for switch in ['backbone.adm.crans.org'] + all_switchs() + ['multiprise-v6']: + # ce code ne fork plus rien du tout depuis e05c4be14c86da88413c598e4c + for switch in all_switchs(hide=[]): tableau.append(interroge_switch(switch, mac, affiche_uplinks)) for t in tableau: