diff --git a/gestion/gen_confs/generate.py b/gestion/gen_confs/generate.py index 85a2303e..407fcca3 100755 --- a/gestion/gen_confs/generate.py +++ b/gestion/gen_confs/generate.py @@ -140,9 +140,13 @@ class rouge(base_reconfigure) : from gen_confs.switchs import switch self._do(switch(chambres)) - def exemptions(self) : - from exemptions import exemptions - self._do(exemptions()) + def surveillance_exemptions(self) : + from gen_confs.surveillance import exemptions + self._do(exemptions()) + + def surveillance_machines(self) : + from gen_confs.surveillance import machines + self._do(machines(),self._machines()) class zamok(base_reconfigure) : # Tout est dans le parent diff --git a/gestion/ldap_crans.py b/gestion/ldap_crans.py index be12af74..3f41df12 100755 --- a/gestion/ldap_crans.py +++ b/gestion/ldap_crans.py @@ -226,7 +226,7 @@ class crans_ldap: scope = { 'adherent': 1 , 'machine': 2 , 'club': 1 } def __init__(self,readonly=False): - self.connect(readonly) + self.connect(readonly) def __del__(self): # Destruction des locks résiduels @@ -236,12 +236,12 @@ class crans_ldap: def connect(self,readonly=False): """ Initialisation la connexion vers le serveur LDAP """ - if readonly : - self.conn = ldap.initialize(ro_uri) - return - - self.conn = ldap.initialize(uri) - + if readonly : + self.conn = ldap.initialize(ro_uri) + return + + self.conn = ldap.initialize(uri) + while True : try: self.conn.bind_s(ldap_auth_dn,ldap_password,ldap.AUTH_SIMPLE) @@ -2486,8 +2486,12 @@ class machine(base_classes_crans): self.services_to_restart('mail_modif',['ip=%s' % self.ip()]) # Synchronisation avec la base pgsql pour les exemptions - if 'exempt' in self.modifs or 'ipHostNumber' in self.modifs: - self.services_to_restart('exemptions') + if 'exempt' in self.modifs or ('ipHostNumber' in self.modifs and self.exempt()): + self.services_to_restart('surveillance_exemptions') + + # Synchronisation avec la base pgsql pour la liste des machines + if 'ipHostNumber' in self.modifs: + self.services_to_restart('surveillance_machines') # Remise à zéro self.modifs=[] @@ -2514,9 +2518,13 @@ class machine(base_classes_crans): else: self.services_to_restart('rouge-dhcp') + if self.exempt(): + self.services_to_restart('surveillance_exemptions') + self.services_to_restart('surveillance_machines') + self.services_to_restart('dns') self.services_to_restart('macip',[self.ip()] ) - + def portTCPin(self,ports=None): """ Ports TCP ouverts depuis l'extérieur pour la machine """ return self.__port(ports,'portTCPin')