From 56c4ecad98a14f7189e417f27175778184229006 Mon Sep 17 00:00:00 2001 From: pauget Date: Wed, 15 Sep 2004 19:24:39 +0200 Subject: [PATCH] IP automatique, Canal et puissance par dfaut pour les bornes wifi. darcs-hash:20040915172439-41617-cd7f95c182aeff6ae8047c413226bd5e192881e7.gz --- gestion/ldap_crans.py | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/gestion/ldap_crans.py b/gestion/ldap_crans.py index c7ef82d9..1311adff 100755 --- a/gestion/ldap_crans.py +++ b/gestion/ldap_crans.py @@ -347,7 +347,11 @@ class crans_ldap : new_args.append(arg) if new_args : modlist = ldap.modlist.modifyModlist({ 'args' : serv[new] }, { 'args' : serv[new] + new_args }) - self.conn.modify_s(serv_dn,modlist) + try : + self.conn.modify_s(serv_dn,modlist) + except ldap.TYPE_OR_VALUE_EXISTS : + # Pas grave + pass # else rien à faire else : modlist = ldap.modlist.addModlist({ 'objectClass' : 'service' , @@ -1575,7 +1579,7 @@ class machine(base_classes_crans) : # Machine vide self.__proprietaire = parent_or_tuple self.dn = parent_or_tuple.dn - self._data={ 'objectClass' : [ 'machine' ] } + self._data={ 'objectClass' : [ 'machine' ] , 'canal' : ['11'], 'puissance' : ['33'] } self._init_data={} self.__typ = typ self._modifiable = 'w' @@ -1718,7 +1722,7 @@ class machine(base_classes_crans) : if ip==None : if self._data.has_key('ipHostNumber') : return decode(self._data['ipHostNumber'][0]) - elif self.proprietaire().__class__ == crans : + elif self.proprietaire().__class__ == crans and self.__typ != 'borne': return '' else : return '' @@ -1728,6 +1732,8 @@ class machine(base_classes_crans) : # Dans quel réseau la machine doit-elle être placée ? if self.__typ == 'wifi' : net = config.NETs['wifi'] + elif self.__typ == 'borne' : + net = config.NETs['bornes'] elif self.proprietaire().__class__ == crans : net = [ '0.0.0.0/0' ] else : @@ -1872,7 +1878,7 @@ class machine(base_classes_crans) : self.services_to_restart('switch',[self.proprietaire().chbre()]) if 'canal' in self.modifs or 'puissance' in self.modifs : - self.services_to_restart('bornes_wifi',['self.nom()']) + self.services_to_restart('bornes_wifi',[self.nom()]) if self.__typ == 'wifi' and ( 'ipHostNumber' in self.modifs or 'host' in self.modifs ) : # Reconfiguration clients wifi necessaire