containers/composer: forward SIGTERM to children
In docker compose and openshift SIGTERM is used to tell containers to shut down gracefully. Forward the signal to the processes we spawned.
This commit is contained in:
parent
367444635a
commit
c21596cd99
1 changed files with 8 additions and 0 deletions
|
|
@ -10,6 +10,7 @@ import argparse
|
|||
import contextlib
|
||||
import os
|
||||
import pathlib
|
||||
import signal
|
||||
import socket
|
||||
import subprocess
|
||||
import sys
|
||||
|
|
@ -302,6 +303,13 @@ class Cli(contextlib.AbstractContextManager):
|
|||
res = 0
|
||||
sockets = self._prepare_sockets()
|
||||
|
||||
def handler(signum, frame):
|
||||
proc_composer.terminate()
|
||||
proc_worker.terminate()
|
||||
proc_dnf_json.terminate()
|
||||
|
||||
signal.signal(signal.SIGTERM, handler)
|
||||
|
||||
liveness = pathlib.Path('/run/live')
|
||||
|
||||
liveness.touch()
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue