[annuaire] On passe sur ula base de données PgSQL

darcs-hash:20100831065041-ffbb2-c44e28237d99ba472e0465ad88f1cd7149e3081d.gz
This commit is contained in:
Nicolas Dandrimont 2010-08-31 08:50:41 +02:00
parent 337905013d
commit a1427076b5
15 changed files with 32 additions and 35 deletions

View file

@ -10,7 +10,7 @@ Auteur :
import sys, os
sys.path.append('/usr/scripts/gestion')
from hptools import hpswitch
from annuaires import all_switchs, bat_switchs, reverse, uplink_prises
from annuaires_pg import all_switchs, bat_switchs, reverse, uplink_prises
from ldap_crans import crans_ldap
from affich_tools import anim, OK
from email_tools import send_email

View file

@ -30,7 +30,7 @@ import sys
sys.path.append('/usr/scripts/gestion')
from ldap_crans import crans_ldap
from annuaires import chbre_prises, reverse
from annuaires_pg import chbre_prises, reverse
from affich_tools import cprint
import sys, datetime
@ -65,7 +65,7 @@ def trouve_prise(chbre):
return chbre
else:
bat = chbre[0].lower()
prise = bat + chbre_prises[bat][chbre[1:]]
prise = bat + chbre_prises(bat, chbre[1:])
if prise[-1] == '-':
prise = prise[:-1]
return prise

View file

@ -18,7 +18,7 @@ from sys import path
path.append('/usr/scripts/gestion')
from annuaires import chbre_prises
from annuaires_pg import chbre_prises, bat_switchs
from affich_tools import *
from ldap_crans import crans_ldap
from ldap_crans import MachineCrans, MachineWifi, BorneWifi
@ -61,7 +61,7 @@ def scan_bats(bats, annuaire=chbre_prises, verbose=False):
# On Commence par itérer sur chaque batiment :
for bat in bats:
prises = dict()
for chbre, prise in annuaire[bat].iteritems():
for chbre, prise in annuaire(bat).iteritems():
prises[prise] = chbre
current_switch = -1
@ -232,7 +232,7 @@ if __name__ == "__main__":
if bats == 'all':
# On récupère tous les bâtiments contenus dans l'annuaire :
lbats = chbre_prises.keys()
lbats = bat_switchs
else:
# On génère une liste avec les bâtiments pour être propre
lbats = [bat for bat in bats]