summaryrefslogtreecommitdiff
path: root/tools/merge_dist.py
diff options
context:
space:
mode:
authorLinus Nordberg <linus@nordu.net>2016-12-03 16:48:07 +0100
committerLinus Nordberg <linus@nordu.net>2016-12-03 16:48:07 +0100
commit22ba9ae76eaee5c4ff792e27881dbf165ec6f326 (patch)
tree1aeacc3e666da609c0eabdbf46f70287612406c4 /tools/merge_dist.py
parent1befdbb267f9c0960b9049cb551b470dbac15ae1 (diff)
merge_backup, merge_dist: Bring child processes down on TERM.
Diffstat (limited to 'tools/merge_dist.py')
-rwxr-xr-xtools/merge_dist.py9
1 files changed, 8 insertions, 1 deletions
diff --git a/tools/merge_dist.py b/tools/merge_dist.py
index f1bdaf9..aa793e6 100755
--- a/tools/merge_dist.py
+++ b/tools/merge_dist.py
@@ -11,6 +11,7 @@ import sys
import json
import requests
import logging
+import signal
from time import sleep
from base64 import b64encode, b64decode
from os import stat
@@ -19,7 +20,8 @@ from certtools import timing_point, create_ssl_context
from mergetools import get_curpos, get_logorder, chunks, get_missingentries, \
publish_sth, sendlog, sendentries, parse_args, perm, \
get_frontend_verifiedsize, frontend_verify_entries, \
- waitforfile, flock_ex_or_fail, Status, loginit, start_worker
+ waitforfile, flock_ex_or_fail, Status, loginit, start_worker, \
+ terminate_child_procs
def sendlog_helper(entries, curpos, nodename, nodeaddress, own_key, paths,
statusupdates):
@@ -207,6 +209,10 @@ def merge_dist_parallel(args, localconfig, frontendnodes, chainsdb, s):
return -1
+def term(signal, arg):
+ terminate_child_procs()
+ sys.exit(1)
+
def main():
"""
Distribute missing entries and the STH to all frontend nodes, in
@@ -231,6 +237,7 @@ def main():
statusfile = mergedb + "/merge_dist.status"
s = Status(statusfile)
+ signal.signal(signal.SIGTERM, term)
create_ssl_context(cafile=paths["https_cacertfile"])
if len(args.node) == 0: