]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
ceph-crash: exit code 0 on SIGINT, SIGTERM
authorSage Weil <sage@redhat.com>
Thu, 16 Jan 2020 19:23:46 +0000 (13:23 -0600)
committerSage Weil <sage@redhat.com>
Thu, 16 Jan 2020 19:25:52 +0000 (13:25 -0600)
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 <sage@redhat.com>
src/ceph-crash.in

index 587f40b76a6af3b7d098bc1b0e26ab444ac904aa..c549dc11fe4be184a6df34a550b0c2c5d172e035 100755 (executable)
@@ -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: