From 9a0ce2872e075c49d87ba17c392a1b1fac15b1e5 Mon Sep 17 00:00:00 2001 From: Romain Beuque Date: Sat, 20 Sep 2014 12:46:08 +0200 Subject: [PATCH] =?UTF-8?q?ajout=20d'une=20exception=20personnalis=C3=A9e?= =?UTF-8?q?=20quand=20il=20n'y=20a=20plus=20d'IP=20disponible?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Brie/brie/controllers/edit.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/Brie/brie/controllers/edit.py b/Brie/brie/controllers/edit.py index 432f03f..e94c5ba 100644 --- a/Brie/brie/controllers/edit.py +++ b/Brie/brie/controllers/edit.py @@ -506,7 +506,11 @@ class MachineAddController(AuthenticatedRestController): # Génération de l'id de la machine et recherche d'une ip libre ip = IpReservation.get_first_free(self.user, residence_dn) - # Rendre l'ip prise + if ip is None: + raise Exception("le pool d'adresse IP est vide. aucune adresse IP disponible pour ajouter une machine") + #end if + + # Indique que l'ip est prise taken_attribute = IpReservation.taken_attr(str(datetime.today())) self.user.ldap_bind.add_attr(ip.dn, taken_attribute)