Merge "swift-ring-builder: exit ERROR (2) on uncaught exceptions"

This commit is contained in:
Zuul 2022-02-15 21:41:44 +00:00 committed by Gerrit Code Review
commit f15c4cc6b5

View File

@ -16,9 +16,22 @@
import sys
import traceback
# We exit code 1 on WARNING statuses, 2 on ERROR. This means we need
# to handle any uncaught exceptions by printing the usual backtrace,
# but then exiting 2 (not 1 as is usual for a python
# exception).
def exit_with_status_two(tp, val, tb):
traceback.print_exception(tp, val, tb)
sys.exit(2)
sys.excepthook = exit_with_status_two
from swift.cli.ringbuilder import main
if __name__ == "__main__":
sys.exit(main())