Completement de whos2b
darcs-hash:20071213073639-d0547-00b5a4883884408c19bcf6312e0cb34fa08c4225.gz
This commit is contained in:
parent
99dfb0fccb
commit
bdd0b8cf9e
1 changed files with 10 additions and 4 deletions
|
@ -6,17 +6,23 @@ sys.path.append('/usr/scripts/gestion')
|
||||||
from ldap_crans import crans_ldap
|
from ldap_crans import crans_ldap
|
||||||
from hptools import hpswitch, ConversationError
|
from hptools import hpswitch, ConversationError
|
||||||
from affich_tools import coul, cprint
|
from affich_tools import coul, cprint
|
||||||
import whos
|
from whos import aff
|
||||||
|
|
||||||
def liste_machines_fixe():
|
def liste_machines_fixe():
|
||||||
sw = hpswitch('batb-0') ## Quel switch il faut ?
|
sw = hpswitch('backbone')
|
||||||
db = crans_ldap()
|
db = crans_ldap()
|
||||||
try:
|
try:
|
||||||
macs = sw.show_prise_mac(48): ## Quelle prise il faut ?
|
macs = sw.show_prise_mac(87)
|
||||||
except ConversationError:
|
except ConversationError:
|
||||||
print coul("Impossible de communiquer avec le switch !")
|
print coul("Impossible de communiquer avec le switch !")
|
||||||
|
machines = []
|
||||||
for mac in macs:
|
for mac in macs:
|
||||||
machines = db.search("mac=%s" % mac)
|
m = db.search("mac=%s" % mac)['machine']
|
||||||
|
if m:
|
||||||
|
machines.append(m[0])
|
||||||
|
else:
|
||||||
|
print "Machine inconnue: %s" % mac
|
||||||
|
aff(machines)
|
||||||
|
|
||||||
|
|
||||||
liste_machines_fixe()
|
liste_machines_fixe()
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue