[gen_confs/generate.py] except UnicodeDecodeError
Pour eviter de tout planter quand un argument d'un service est mauvais darcs-hash:20100308095608-ddb99-bf429d9c66267edb3e5c17106d3c7f314a346627.gz
This commit is contained in:
parent
6807a084b6
commit
23d05f16e7
1 changed files with 12 additions and 3 deletions
|
@ -105,7 +105,10 @@ class base_reconfigure:
|
|||
if reste:
|
||||
print "Reste à faire :"
|
||||
for s in reste:
|
||||
try:
|
||||
print '\t%s' % s
|
||||
except UnicodeDecodeError:
|
||||
print '\t%s: non imprimable' % s.nom
|
||||
else:
|
||||
print "Plus rien à faire"
|
||||
|
||||
|
@ -347,7 +350,10 @@ remove_lock('auto_generate')
|
|||
if __name__ == '__main__':
|
||||
openlog('generate', LOG_PID)
|
||||
for x in db.services_to_restart():
|
||||
try:
|
||||
syslog(str(x))
|
||||
except UnicodeDecodeError:
|
||||
syslog("%s: non imprimable" % x.nom)
|
||||
classe = eval(hostname)
|
||||
|
||||
args_autorises = ['quiet', 'remove=', 'add=', 'list', 'help', 'reconnect']
|
||||
|
@ -385,7 +391,10 @@ if __name__ == '__main__':
|
|||
elif opt == '--list':
|
||||
print 'Services à redémarrer :'
|
||||
for s in db.services_to_restart():
|
||||
try:
|
||||
print '\t%s' % s
|
||||
except UnicodeDecodeError:
|
||||
print '\t%s: non imprimable' % s.nom
|
||||
sys.exit(0)
|
||||
|
||||
elif opt == '--reconnect':
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue