From 68fd355dad7bfc146d73174379eb33c1ca7349f2 Mon Sep 17 00:00:00 2001 From: Daniel STAN Date: Wed, 27 Jun 2012 21:46:06 +0200 Subject: [PATCH] =?UTF-8?q?[crans=5Futils]=20ip=5Fof=5Fmid:=20mid=20sp?= =?UTF-8?q?=C3=A9ciaux?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- crans_utils.py | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/crans_utils.py b/crans_utils.py index b4b498c..33c5620 100644 --- a/crans_utils.py +++ b/crans_utils.py @@ -41,6 +41,12 @@ def ip_of_mid(mid): break else: raise ValueError("Mid dans aucune plage: %d" % mid) + + if net == 'special': + try: + return netaddr.IPAddress(config.mid_machines_speciales[mid]) + except KeyError: + return ValueError(u"Machine speciale inconnue: %d" % mid) return netaddr.IPAddress(netaddr.IPNetwork(config.NETs[net][0]).first + mid - plage[0])