[gen_confs/switchs.py] on récupère la première ligne de la conf depuis le switch
Ignore-this: 28adbb199ef5bd83b58f20ea4320505b darcs-hash:20090302143657-bd074-c53e93c464eb46cf527e4431c208fda82a5570a0.gz
This commit is contained in:
parent
eb82b03462
commit
8905c9ca16
2 changed files with 33 additions and 25 deletions
|
@ -14,7 +14,7 @@
|
||||||
Dans tous les cas FAIRE LE SNMP A LA MAIN (script hpttols)
|
Dans tous les cas FAIRE LE SNMP A LA MAIN (script hpttols)
|
||||||
"""
|
"""
|
||||||
|
|
||||||
import string, sys, os, commands, smtplib
|
import string, sys, os, commands, smtplib, tempfile
|
||||||
|
|
||||||
sys.path.append('/usr/scripts/gestion')
|
sys.path.append('/usr/scripts/gestion')
|
||||||
from hptools import hpswitch, sw_chbre
|
from hptools import hpswitch, sw_chbre
|
||||||
|
@ -31,7 +31,7 @@ class switch(gen_config) :
|
||||||
# Répertoire ou écire les fichiers de conf
|
# Répertoire ou écire les fichiers de conf
|
||||||
CONF_REP='/tmp/' # avec un / derrière
|
CONF_REP='/tmp/' # avec un / derrière
|
||||||
|
|
||||||
config = """; Configuration Editor; Created on release #H.08.86
|
config = """%(switch_config_header)s
|
||||||
|
|
||||||
hostname "%(switch)s"
|
hostname "%(switch)s"
|
||||||
;-------------------------------------------------------- Snmp
|
;-------------------------------------------------------- Snmp
|
||||||
|
@ -253,6 +253,14 @@ exit
|
||||||
# Batiment et numéro du switch
|
# Batiment et numéro du switch
|
||||||
bat = switch[3].lower()
|
bat = switch[3].lower()
|
||||||
sw_num = int(switch[5])
|
sw_num = int(switch[5])
|
||||||
|
old_config = NamedTemporaryFile()
|
||||||
|
res, msg = commands.getstatusoutput("scp bat%s-%i:cfg/startup-config %s" % (bat, sw_num, old_config.name))
|
||||||
|
|
||||||
|
if not res:
|
||||||
|
raise RuntimeError(u"Erreur : impossible de récupérer l'ancienne configuration du switch")
|
||||||
|
|
||||||
|
params['switch_config_header'] = old_config.readline()
|
||||||
|
old_config.close()
|
||||||
|
|
||||||
# Conf radius
|
# Conf radius
|
||||||
sys.path.append('/usr/scripts/gestion/secrets')
|
sys.path.append('/usr/scripts/gestion/secrets')
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue