[gen_confs/generate] Modification du handling des signaux seulement dans le __main__

sinon, ça fait du caca quand on veux l'importer
This commit is contained in:
Valentin Samir 2014-02-24 17:20:10 +01:00
parent 2c6cdb7201
commit 9a93373ab8
2 changed files with 2 additions and 46 deletions

View file

@ -28,8 +28,6 @@ from syslog import *
import platform
openlog("generate")
signal.signal(signal.SIGINT, signal.SIG_IGN) # Pas de Ctrl-C
db = crans_ldap()
make_lock('auto_generate', 'Big lock', nowait=1)
@ -323,10 +321,10 @@ class gordon(base_reconfigure) :
class titanic(base_reconfigure):
pass
signal.signal(signal.SIGINT, signal.SIG_DFL) # Comportement normal de Ctrl-C
remove_lock('auto_generate')
if __name__ == '__main__':
signal.signal(signal.SIGINT, signal.SIG_IGN) # Pas de Ctrl-C
openlog('generate', LOG_PID)
for x in db.services_to_restart():
try:
@ -418,3 +416,4 @@ if __name__ == '__main__':
# On fait ce qu'il y a à faire
classe(to_do)
signal.signal(signal.SIGINT, signal.SIG_DFL) # Comportement normal de Ctrl-C