On indique que les services n'ont plus tre relancs uniquement si tout

s'est bien pass (Fred boulet)

darcs-hash:20040902063257-d1718-1481891b941270c5e9b0175cd9fe713f6a17eaf2.gz
This commit is contained in:
bernat 2004-09-02 08:32:57 +02:00
parent a2411248dc
commit ae62a7f13d

View file

@ -11,6 +11,11 @@ from affich_tools import anim, cprint, OK, ERREUR, WARNING
from time import localtime from time import localtime
import config import config
# On vérifie que l'on es root
if os.getuid() != 0:
sys.stderr.write("Il faut être root\n")
sys.exit(1)
signal.signal(signal.SIGINT,signal.SIG_IGN) # Pas de Ctrl-C signal.signal(signal.SIGINT,signal.SIG_IGN) # Pas de Ctrl-C
db = crans_ldap() db = crans_ldap()
@ -46,7 +51,6 @@ else :
inst = [] inst = []
if 'home' in to_do.keys() : if 'home' in to_do.keys() :
if auto : db.services_to_restart('-home')
cprint('Création home','gras') cprint('Création home','gras')
for args in to_do['home'] : for args in to_do['home'] :
anim('\t' + args) anim('\t' + args)
@ -63,6 +67,7 @@ if 'home' in to_do.keys() :
sys.stderr.write(output+'\n') sys.stderr.write(output+'\n')
else : else :
print OK print OK
if auto : db.services_to_restart('-home')
except : except :
print ERREUR print ERREUR
if debug : if debug :
@ -70,7 +75,6 @@ if 'home' in to_do.keys() :
traceback.print_exc() traceback.print_exc()
if 'ML-ENS' in to_do.keys() : if 'ML-ENS' in to_do.keys() :
db.services_to_restart('-ML-ENS')
cprint('Inscription ML-ENS','gras') cprint('Inscription ML-ENS','gras')
for mail in to_do['ML-ENS'] : for mail in to_do['ML-ENS'] :
anim('\t'+mail) anim('\t'+mail)
@ -82,20 +86,21 @@ if 'ML-ENS' in to_do.keys() :
sys.stderr.write(output+'\n') sys.stderr.write(output+'\n')
else : else :
print OK print OK
db.services_to_restart('-ML-ENS')
if 'droits' in to_do.keys() : if 'droits' in to_do.keys() :
db.services_to_restart('-droits')
from gen_confs.droits import droits from gen_confs.droits import droits
a = droits() a = droits()
a.debug = debug a.debug = debug
a.reconfigure() a.reconfigure()
db.services_to_restart('-droits')
if 'switch' in to_do.keys() : if 'switch' in to_do.keys() :
if auto : db.services_to_restart('-switch')
from gen_confs.switchs import switch from gen_confs.switchs import switch
a = switch(to_do['switch']) a = switch(to_do['switch'])
a.debug = debug a.debug = debug
a.reconfigure() a.reconfigure()
if auto : db.services_to_restart('-switch')
# Les services suivants ont besoin de la liste des machines # Les services suivants ont besoin de la liste des machines
# On va donc la lire une seule fois pour leur passer ensuite # On va donc la lire une seule fois pour leur passer ensuite
@ -104,9 +109,9 @@ if 'firewall' in to_do.keys() :
# Quand sila et komaz liront la base LDAP # Quand sila et komaz liront la base LDAP
# db.services_to_restart('firewall-komaz') # db.services_to_restart('firewall-komaz')
# db.services_to_restart('firewall-sila') # db.services_to_restart('firewall-sila')
db.services_to_restart('-firewall')
from gen_confs.firewall import firewall from gen_confs.firewall import firewall
inst.append(firewall()) inst.append(firewall())
db.services_to_restart('-firewall')
if 'dns' in to_do.keys() : if 'dns' in to_do.keys() :
db.services_to_restart('-dns') db.services_to_restart('-dns')
@ -115,8 +120,8 @@ if 'dns' in to_do.keys() :
if 'dhcp' in to_do.keys() : if 'dhcp' in to_do.keys() :
from gen_confs.dhcpd import dhcp from gen_confs.dhcpd import dhcp
db.services_to_restart('-dhcp')
inst.append(dhcp()) inst.append(dhcp())
db.services_to_restart('-dhcp')
##### On fait ce qu'il reste à faire ##### On fait ce qu'il reste à faire