28 lines
608 B
Python
Executable file
28 lines
608 B
Python
Executable file
#! /usr/bin/env python
|
|
|
|
import sys
|
|
|
|
sys.path.append('/usr/scripts/gestion')
|
|
from ldap_crans import crans_ldap
|
|
from hptools import hpswitch, ConversationError
|
|
from affich_tools import coul, cprint
|
|
from whos import aff
|
|
|
|
def liste_machines_fixe():
|
|
sw = hpswitch('backbone')
|
|
db = crans_ldap()
|
|
try:
|
|
macs = sw.show_prise_mac(87)
|
|
except ConversationError:
|
|
print coul("Impossible de communiquer avec le switch !")
|
|
machines = []
|
|
for mac in macs:
|
|
m = db.search("mac=%s" % mac)['machine']
|
|
if m:
|
|
machines.append(m[0])
|
|
else:
|
|
print "Machine inconnue: %s" % mac
|
|
aff(machines)
|
|
|
|
|
|
liste_machines_fixe()
|