From 9507536d3ebc19b0d63d1809ad2f843c2d7fd5af Mon Sep 17 00:00:00 2001 From: Gabriel Detraz Date: Sat, 19 Sep 2015 21:36:31 +0200 Subject: [PATCH] =?UTF-8?q?Bug=20pour=20les=20swicths=20publiques=20lors?= =?UTF-8?q?=20de=20la=20g=C3=A9n=C3=A9ration=20du=20sch=C3=A9ma=20de=20bra?= =?UTF-8?q?ssage?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- gestion/gen_confs/switchs2.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/gestion/gen_confs/switchs2.py b/gestion/gen_confs/switchs2.py index 7395cf5a..34a72341 100755 --- a/gestion/gen_confs/switchs2.py +++ b/gestion/gen_confs/switchs2.py @@ -441,7 +441,11 @@ def format_prises_group(data, first, last): def pretty_print(hostname): """Affiche joliement le plan de connexion d'un switch""" bat, sw_num = get_bat_num(hostname) - switch = ldap.search(u'host=bat%s-%d.adm.crans.org' % (bat, sw_num))[0] + + try: + switch = ldap.search(u'host=bat%s-%d.adm.crans.org' % (bat, sw_num))[0] + except IndexError: + switch = ldap.search(u'host=bat%s-%d.crans.org' % (bat, sw_num))[0] port_dict = get_port_dict(switch) total = max(port_dict.keys())