Changement dans la gestion des erreurs.
darcs-hash:20040915162136-41617-7be86eaaf4f1818c8cd9dbfea086576ded5021db.gz
This commit is contained in:
parent
9fa4f67728
commit
d212e859ec
1 changed files with 12 additions and 14 deletions
|
@ -11,7 +11,7 @@ from affich_tools import anim, cprint, OK, ERREUR, WARNING
|
||||||
from time import localtime, strftime
|
from time import localtime, strftime
|
||||||
import config
|
import config
|
||||||
|
|
||||||
# On vérifie que l'on es root
|
# On vérifie que l'on est root
|
||||||
if os.getuid() != 0:
|
if os.getuid() != 0:
|
||||||
sys.stderr.write("Il faut être root\n")
|
sys.stderr.write("Il faut être root\n")
|
||||||
sys.exit(1)
|
sys.exit(1)
|
||||||
|
@ -138,7 +138,6 @@ if gethostname().split(".")[0] == 'zamok':
|
||||||
if 'mail_bienvenue' in to_do.keys() :
|
if 'mail_bienvenue' in to_do.keys() :
|
||||||
if auto : db.services_to_restart('-mail_bienvenue')
|
if auto : db.services_to_restart('-mail_bienvenue')
|
||||||
cprint('Envoi mail de bienvenue','gras')
|
cprint('Envoi mail de bienvenue','gras')
|
||||||
pas_fait = []
|
|
||||||
for mail in to_do['mail_bienvenue'] :
|
for mail in to_do['mail_bienvenue'] :
|
||||||
anim('\t' + mail)
|
anim('\t' + mail)
|
||||||
try :
|
try :
|
||||||
|
@ -151,12 +150,10 @@ if gethostname().split(".")[0] == 'zamok':
|
||||||
print OK
|
print OK
|
||||||
except Exception, c:
|
except Exception, c:
|
||||||
print ERREUR
|
print ERREUR
|
||||||
pas_fait.append(mail)
|
if auto : db.services_to_restart('mail_bienvenue',[mail])
|
||||||
if debug :
|
if debug :
|
||||||
import traceback
|
import traceback
|
||||||
traceback.print_exc()
|
traceback.print_exc()
|
||||||
if auto and pas_fait :
|
|
||||||
db.services_to_restart('mail_bienvenue',pas_fait)
|
|
||||||
|
|
||||||
if 'ML-ENS' in to_do.keys() :
|
if 'ML-ENS' in to_do.keys() :
|
||||||
if auto : db.services_to_restart('-ML-ENS')
|
if auto : db.services_to_restart('-ML-ENS')
|
||||||
|
@ -183,7 +180,6 @@ if gethostname().split(".")[0] == 'zamok':
|
||||||
a.reconfigure()
|
a.reconfigure()
|
||||||
except:
|
except:
|
||||||
if auto : db.services_to_restart('droits')
|
if auto : db.services_to_restart('droits')
|
||||||
raise
|
|
||||||
|
|
||||||
if 'switch' in to_do.keys() :
|
if 'switch' in to_do.keys() :
|
||||||
if auto : db.services_to_restart('-switch')
|
if auto : db.services_to_restart('-switch')
|
||||||
|
@ -194,7 +190,7 @@ if gethostname().split(".")[0] == 'zamok':
|
||||||
a.reconfigure()
|
a.reconfigure()
|
||||||
except:
|
except:
|
||||||
if auto : db.services_to_restart('switch',to_do['switch'])
|
if auto : db.services_to_restart('switch',to_do['switch'])
|
||||||
raise
|
sys.stdout.write('Erreur dans la config des switchs.\n')
|
||||||
|
|
||||||
# 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
|
||||||
|
@ -250,7 +246,7 @@ if gethostname().split(".")[0] == 'zamok':
|
||||||
except :
|
except :
|
||||||
# Erreur, il faudra relancer le service la prochaine fois
|
# Erreur, il faudra relancer le service la prochaine fois
|
||||||
if auto : db.services_to_restart('%s' % i[1])
|
if auto : db.services_to_restart('%s' % i[1])
|
||||||
sys.stderr.write('Erreur dans le service %s\n' % i[1])
|
sys.stdout.write('Erreur dans la config de %s.\n' % i[1])
|
||||||
|
|
||||||
elif gethostname().split(".")[0] == 'nectaris':
|
elif gethostname().split(".")[0] == 'nectaris':
|
||||||
# On s'occupe de nectaris
|
# On s'occupe de nectaris
|
||||||
|
@ -263,7 +259,8 @@ elif gethostname().split(".")[0] == 'nectaris':
|
||||||
a.reconfigure()
|
a.reconfigure()
|
||||||
except:
|
except:
|
||||||
if auto : db.services_to_restart('conf_wifi')
|
if auto : db.services_to_restart('conf_wifi')
|
||||||
raise
|
sys.stdout.write('Erreur dans la config du wifi.\n')
|
||||||
|
|
||||||
if 'bornes_wifi' in to_do.keys():
|
if 'bornes_wifi' in to_do.keys():
|
||||||
if auto : db.services_to_restart('-bornes_wifi')
|
if auto : db.services_to_restart('-bornes_wifi')
|
||||||
try:
|
try:
|
||||||
|
@ -274,7 +271,8 @@ elif gethostname().split(".")[0] == 'nectaris':
|
||||||
except:
|
except:
|
||||||
# Pas terrible : on va redemarrer les bornes qui ont redemarré correctement
|
# Pas terrible : on va redemarrer les bornes qui ont redemarré correctement
|
||||||
if auto : db.services_to_restart('bornes_wifi', to_do['bornes_wifi'])
|
if auto : db.services_to_restart('bornes_wifi', to_do['bornes_wifi'])
|
||||||
raise
|
sys.stdout.write('Erreur dans la config des bornes wifi.\n')
|
||||||
|
|
||||||
if 'droits-nectaris' in to_do.keys():
|
if 'droits-nectaris' in to_do.keys():
|
||||||
if auto : db.services_to_restart('-droits-nectaris')
|
if auto : db.services_to_restart('-droits-nectaris')
|
||||||
try:
|
try:
|
||||||
|
@ -284,7 +282,7 @@ elif gethostname().split(".")[0] == 'nectaris':
|
||||||
a.reconfigure()
|
a.reconfigure()
|
||||||
except:
|
except:
|
||||||
if auto : db.services_to_restart('droits-nectaris')
|
if auto : db.services_to_restart('droits-nectaris')
|
||||||
raise
|
sys.stdout.write('Erreur dans la config des droits sur nectaris.\n')
|
||||||
|
|
||||||
if debug :
|
if debug :
|
||||||
print 'Non traité ici mais signalé dans la base LDAP : \n\t', db.services_to_restart()
|
print 'Non traité ici mais signalé dans la base LDAP : \n\t', db.services_to_restart()
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue