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())