From c1cfb3c8ae501e006ff10986819158d0488bd791 Mon Sep 17 00:00:00 2001 From: bernat Date: Thu, 2 Sep 2004 11:21:57 +0200 Subject: [PATCH] On note un service comme redmarr uniquement si c'est effectivement le cas darcs-hash:20040902092157-d1718-acf85ce4d7223916633910643a4ceedcf9dd23e8.gz --- gestion/gen_confs/generate.py | 23 ++++++++++++----------- gestion/gen_confs/switchs.py | 2 +- 2 files changed, 13 insertions(+), 12 deletions(-) diff --git a/gestion/gen_confs/generate.py b/gestion/gen_confs/generate.py index af318c4d..22bb9854 100755 --- a/gestion/gen_confs/generate.py +++ b/gestion/gen_confs/generate.py @@ -104,24 +104,22 @@ if 'switch' in to_do.keys() : # Les services suivants ont besoin de la liste des machines # On va donc la lire une seule fois pour leur passer ensuite - + +restartlater = [] if 'firewall' in to_do.keys() : # Quand sila et komaz liront la base LDAP # db.services_to_restart('firewall-komaz') # db.services_to_restart('firewall-sila') from gen_confs.firewall import firewall - inst.append(firewall()) - db.services_to_restart('-firewall') + inst.append([firewall(),"firewall"]) if 'dns' in to_do.keys() : - db.services_to_restart('-dns') from gen_confs.bind import dns - inst.append(dns()) + inst.append([dns(),"dns"]) if 'dhcp' in to_do.keys() : from gen_confs.dhcpd import dhcp - inst.append(dhcp()) - db.services_to_restart('-dhcp') + inst.append([dhcp(),"dhcp"]) ##### On fait ce qu'il reste à faire @@ -145,13 +143,16 @@ if inst : print OK #### Reconfiguration des services + for i in inst : - i.debug = debug - i.machines = machines + i[0].debug = debug + i[0].machines = machines try : - i.reconfigure() + i[0].reconfigure() + if auto : db.services_to_restart('-%s' % i[1]) except : - sys.stderr.write('Erreur dans le service %s\n' % i) + sys.stderr.write('Erreur dans le service %s\n' % i[1]) + if debug : print 'Non traité ici mais signalé dans la base LDAP : \n\t', db.services_to_restart() diff --git a/gestion/gen_confs/switchs.py b/gestion/gen_confs/switchs.py index 1e73ef20..3d1602db 100755 --- a/gestion/gen_confs/switchs.py +++ b/gestion/gen_confs/switchs.py @@ -52,7 +52,7 @@ class switch(gen_config) : a = self.db.search('chbre=%s' % chbre)['adherent'] action = '' for adh in a : - if (((ann_scol in adh.paiement()) or ((ann_scol-1) in adh.paiement and localtime()[1]==9)) and 'bloq' not in adh.blacklist_actif()) : + if (((ann_scol in adh.paiement()) or ((ann_scol-1) in adh.paiement() and localtime()[1]==9)) and 'bloq' not in adh.blacklist_actif()) : # Il faut activer la prise anim('\tactivation chbre %s' % chbre) action = 'enable'