doorlockd.py: Add config parameter for hooks

Signed-off-by: Ralf Ramsauer <ralf@binary-kitchen.de>
This commit is contained in:
Ralf Ramsauer 2018-03-21 00:58:16 +01:00
parent 6e2655e6e5
commit 4d1682d1bd
2 changed files with 4 additions and 2 deletions

View File

@ -1,5 +1,6 @@
DEBUG = True
SIMULATE = True
RUN_HOOKS = True
SECRET_KEY = 'foobar'
BOOTSTRAP_SERVE_LOCAL = True

View File

@ -60,6 +60,7 @@ socketio = SocketIO(webapp, async_mode=None)
Bootstrap(webapp)
serial_port = webapp.config.get('SERIAL_PORT')
simulate = webapp.config.get('SIMULATE')
run_hooks = webapp.config.get('RUN_HOOKS')
# copied from sudo
eperm_insults = {
@ -89,8 +90,8 @@ def choose_insult():
def start_hook(script):
if simulate:
log.info('Simulation mode: not starting %s' % script)
if not run_hooks:
log.info('Hooks disabled: not starting %s' % script)
return
log.info('Starting hook %s' % script)
Popen(['nohup', script])