diff --git a/gestion/tools/locate-mac.py b/gestion/tools/locate-mac.py index 279204de..df7032e2 100755 --- a/gestion/tools/locate-mac.py +++ b/gestion/tools/locate-mac.py @@ -16,18 +16,18 @@ mac = ":".join([i.zfill(2) for i in sys.argv[1].split(":")]).lower() # classe d'interrogation des switchs class interroge_switch (threading.Thread) : def __init__ (self, switch, mac = None) : - threading.Thread.__init__(self) - self.switch = switch - self.mac = mac - self.start() + threading.Thread.__init__(self) + self.switch = switch + self.mac = mac + self.start() def run (self) : - sw = hpswitch(self.switch) - prise = sw.where_is_mac(mac) - if prise != None : - # on a trouvé une prise, on affiche si c'est pas un uplink - if 'uplink' not in sw.nom(None, prise) or switch == 'backbone' : - print "%-10s => prise %-2s : %s" % (self.switch, str(prise), sw.nom(None, prise)) + sw = hpswitch(self.switch) + prise = sw.where_is_mac(mac) + if prise != None : + # on a trouvé une prise, on affiche si c'est pas un uplink + if 'uplink' not in sw.nom(None, prise) or switch == 'backbone' : + print "%-10s => prise %-2s : %s" % (self.switch, str(prise), sw.nom(None, prise)) # on onterroge trois fois car il donne pas toujours les clients for switch in ['backbone'] + all_switchs(): @@ -37,4 +37,4 @@ while len(threading.enumerate()) > 1 : sleep(1) print -system('whos mac=%s' % mac) +system('/usr/scripts/gestion/whos.py mac=%s' % mac)