Merge "Log signal handling at notice"

This commit is contained in:
Zuul 2022-05-02 16:10:27 +00:00 committed by Gerrit Code Review
commit 59701f3fcd
3 changed files with 3 additions and 2 deletions

View File

@ -138,7 +138,7 @@ class DaemonStrategy(object):
def kill_children(*args):
self.running = False
self.logger.info('SIGTERM received')
self.logger.notice('SIGTERM received (%s)', os.getpid())
signal.signal(signal.SIGTERM, signal.SIG_IGN)
os.killpg(0, signal.SIGTERM)
os._exit(0)

View File

@ -1163,7 +1163,7 @@ def run_wsgi(conf_path, app_section, *args, **kwargs):
logger.error('Stopping with unexpected signal %r' %
running_context[1])
else:
logger.error('%s received (%s)', signame, os.getpid())
logger.notice('%s received (%s)', signame, os.getpid())
if running_context[1] == signal.SIGTERM:
os.killpg(0, signal.SIGTERM)
elif running_context[1] == signal.SIGUSR1:

View File

@ -139,6 +139,7 @@ class TestRunDaemon(unittest.TestCase):
with mock.patch('swift.common.daemon.os') as mock_os:
func()
self.assertEqual(mock_os.method_calls, [
mock.call.getpid(),
mock.call.killpg(0, signal.SIGTERM),
# hard exit because bare except handlers can trap SystemExit
mock.call._exit(0)