From: Sage Weil Date: Thu, 16 Jan 2020 19:23:46 +0000 (-0600) Subject: ceph-crash: exit code 0 on SIGINT, SIGTERM X-Git-Tag: v15.1.0~172^2~3 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=4b93fb8d31a9ac9125a1b5dda93908db48fa69be;p=ceph.git ceph-crash: exit code 0 on SIGINT, SIGTERM This makes the systemd unit not go into a failure state when you kill the cephadm unit's podman container. Signed-off-by: Sage Weil --- diff --git a/src/ceph-crash.in b/src/ceph-crash.in index 587f40b76a6af..c549dc11fe4be 100755 --- a/src/ceph-crash.in +++ b/src/ceph-crash.in @@ -5,6 +5,7 @@ import argparse import logging import os +import signal import socket import subprocess import sys @@ -75,8 +76,15 @@ def scrape_path(path): (metapath, p, os.path.join('posted/', p)) ) +def handler(signum, frame): + print('*** Interrupted with signal %d ***' % signum) + sys.exit(0) def main(): + # exit code 0 on SIGINT, SIGTERM + signal.signal(signal.SIGINT, handler) + signal.signal(signal.SIGTERM, handler) + args = parse_args() postdir = os.path.join(args.path, 'posted') if args.name: