From 4b93fb8d31a9ac9125a1b5dda93908db48fa69be Mon Sep 17 00:00:00 2001 From: Sage Weil Date: Thu, 16 Jan 2020 13:23:46 -0600 Subject: [PATCH] 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 --- src/ceph-crash.in | 8 ++++++++ 1 file changed, 8 insertions(+) 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: -- 2.39.5