Bug pour clubs lors de la reconfiguration totale d'un switch
Liste des swtichs darcs-hash:20040930224424-41617-e390d834ebf495064eb454fb9ac0c1d0c721d2bf.gz
This commit is contained in:
parent
5282b14f34
commit
843ec90b95
1 changed files with 20 additions and 9 deletions
|
@ -19,10 +19,11 @@ import string, sys, os, commands, smtplib
|
|||
|
||||
sys.path.append('/usr/scripts/gestion')
|
||||
from hptools import hpswitch, sw_chbre
|
||||
from ldap_crans import crans_ldap, ann_scol
|
||||
from ldap_crans import crans_ldap
|
||||
from annuaires import chbre_prises, uplink_prises, reverse
|
||||
from gen_confs import *
|
||||
from time import localtime
|
||||
|
||||
# Liste des switchs
|
||||
bat_switchs = [ 'b', 'c' , 'h' , 'i' , 'g' , 'j' ]
|
||||
|
||||
|
@ -133,7 +134,7 @@ exit
|
|||
try :
|
||||
bat = chbre[0].lower()
|
||||
prise = sw_chbre(chbre)
|
||||
a = self.db.search('chbre=%s&paiement=%i' % (chbre,ann_scol))
|
||||
a = self.db.search('chbre=%s&paiement=ok' % chbre)
|
||||
a = a['adherent'] + a['club']
|
||||
sujet = ''
|
||||
if a and 'bloq' not in a[0].blacklist_actif() :
|
||||
|
@ -282,16 +283,17 @@ exit
|
|||
|
||||
# Macs sur la prise
|
||||
nb = 0
|
||||
adh = self.db.search('chbre=%s%s' % (bat.upper(), chbre) )['adherent']
|
||||
res = self.db.search('chbre=%s%s' % (bat.upper(), chbre) )
|
||||
res = res['adherent'] + res['club']
|
||||
if nb>=3 :
|
||||
warn += 'Trop de macs sur la prise %i\n' % prise
|
||||
continue
|
||||
if not adh :
|
||||
if not res :
|
||||
continue
|
||||
elif len(adh) == 1 :
|
||||
adh = adh[0]
|
||||
if 'bloq' in adh.blacklist_actif() : continue
|
||||
for m in adh.machines() :
|
||||
elif len(res) == 1 :
|
||||
res = res[0]
|
||||
if 'bloq' in res.blacklist_actif() : continue
|
||||
for m in res.machines() :
|
||||
macs += ' ' + m.mac().encode('iso-8859-15').replace(':','')
|
||||
nb += 1
|
||||
else :
|
||||
|
@ -320,6 +322,15 @@ if __name__ == '__main__' :
|
|||
print "Génération du fichier de configuration des switchs donnés."
|
||||
sys.exit(255)
|
||||
|
||||
sw = switch(tuple(sys.argv[1:]))
|
||||
if sys.argv[1] == 'all' :
|
||||
switchs = ( 'batg-6', 'batg-5', 'batg-4', 'batg-2', 'batg-1', 'batg' ,
|
||||
'batj-2', 'batj-1', 'batj' ,
|
||||
'bati-1', 'bati' ,
|
||||
'bath-1', 'bath' ,
|
||||
'batc-2', 'batc-1', 'batc' ,
|
||||
'batb-3', 'batb-2', 'batb-1', 'batb' )
|
||||
else :
|
||||
switchs = tuple(sys.argv[1:])
|
||||
sw = switch(switchs)
|
||||
sw.debug = 1
|
||||
sw.reconfigure()
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue