From 4b5fbee8368ed1838acbf83fddc0aa516e6c7ebf Mon Sep 17 00:00:00 2001 From: Jeremie Dimino Date: Wed, 20 Oct 2010 18:22:57 +0200 Subject: [PATCH] =?UTF-8?q?adapte=20la=20g=C3=A9n=C3=A9ration=20de=20la=20?= =?UTF-8?q?configuration=20des=20switchs=20pour=20les=20nouveaux=20switchs?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Ignore-this: 80bb1dc084e7e53445fbba71dfcb45c7 darcs-hash:20101020162257-af139-f85e2b7f9803ac5c95d6f4dbbb52a6ec67a70c04.gz --- gestion/gen_confs/switchs.py | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/gestion/gen_confs/switchs.py b/gestion/gen_confs/switchs.py index ec2ee48e..fe2fb740 100644 --- a/gestion/gen_confs/switchs.py +++ b/gestion/gen_confs/switchs.py @@ -41,6 +41,7 @@ class switch(gen_config) : config = """%(switch_config_header)s hostname "%(switch)s" +%(module-type)s ;-------------------------------------------------------- Snmp snmp-server contact "root@crans.org" snmp-server location "Batiment %(bat)s" @@ -291,7 +292,7 @@ exit old_config = NamedTemporaryFile() res, msg = commands.getstatusoutput("scp bat%s-%i:cfg/startup-config %s" % (bat, sw_num, old_config.name)) - if not res: + if res != 0: raise RuntimeError(u"Erreur : impossible de récupérer l'ancienne configuration du switch") params['switch_config_header'] = old_config.readline() @@ -301,6 +302,12 @@ exit else: params['switch_config_header']= '; J4899A Configuration Editor; Created on release #H.10.50' + model = params['switch_config_header'].split(' ', 2)[1] + if model == "J9145A": + params['module-type'] = 'module 1 type J9145A' + else: + params['module-type'] = '' + # IP machine = self.db.search(switch)['machine'][0] params['ip'] = str(machine.ip())