From 99dfb0fccb76b1d504a774234a14087428d43a83 Mon Sep 17 00:00:00 2001 From: Michel Blockelet Date: Wed, 12 Dec 2007 15:02:04 +0100 Subject: [PATCH] Creation who2b.py darcs-hash:20071212140204-ddb99-fbd8cf41612769c840584eac6474ca2ebb463c9e.gz --- gestion/tools/who2b.py | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) create mode 100755 gestion/tools/who2b.py diff --git a/gestion/tools/who2b.py b/gestion/tools/who2b.py new file mode 100755 index 00000000..d095f9f2 --- /dev/null +++ b/gestion/tools/who2b.py @@ -0,0 +1,22 @@ +#! /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 +import whos + +def liste_machines_fixe(): + sw = hpswitch('batb-0') ## Quel switch il faut ? + db = crans_ldap() + try: + macs = sw.show_prise_mac(48): ## Quelle prise il faut ? + except ConversationError: + print coul("Impossible de communiquer avec le switch !") + for mac in macs: + machines = db.search("mac=%s" % mac) + + +liste_machines_fixe()