[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:
|
if reste:
|
||||||
print "Reste à faire :"
|
print "Reste à faire :"
|
||||||
for s in reste:
|
for s in reste:
|
||||||
print '\t%s' % s
|
try:
|
||||||
|
print '\t%s' % s
|
||||||
|
except UnicodeDecodeError:
|
||||||
|
print '\t%s: non imprimable' % s.nom
|
||||||
else:
|
else:
|
||||||
print "Plus rien à faire"
|
print "Plus rien à faire"
|
||||||
|
|
||||||
|
@ -347,7 +350,10 @@ remove_lock('auto_generate')
|
||||||
if __name__ == '__main__':
|
if __name__ == '__main__':
|
||||||
openlog('generate', LOG_PID)
|
openlog('generate', LOG_PID)
|
||||||
for x in db.services_to_restart():
|
for x in db.services_to_restart():
|
||||||
syslog(str(x))
|
try:
|
||||||
|
syslog(str(x))
|
||||||
|
except UnicodeDecodeError:
|
||||||
|
syslog("%s: non imprimable" % x.nom)
|
||||||
classe = eval(hostname)
|
classe = eval(hostname)
|
||||||
|
|
||||||
args_autorises = ['quiet', 'remove=', 'add=', 'list', 'help', 'reconnect']
|
args_autorises = ['quiet', 'remove=', 'add=', 'list', 'help', 'reconnect']
|
||||||
|
@ -385,7 +391,10 @@ if __name__ == '__main__':
|
||||||
elif opt == '--list':
|
elif opt == '--list':
|
||||||
print 'Services à redémarrer :'
|
print 'Services à redémarrer :'
|
||||||
for s in db.services_to_restart():
|
for s in db.services_to_restart():
|
||||||
print '\t%s' % s
|
try:
|
||||||
|
print '\t%s' % s
|
||||||
|
except UnicodeDecodeError:
|
||||||
|
print '\t%s: non imprimable' % s.nom
|
||||||
sys.exit(0)
|
sys.exit(0)
|
||||||
|
|
||||||
elif opt == '--reconnect':
|
elif opt == '--reconnect':
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue