From: Alfredo Deza Date: Mon, 18 Aug 2014 20:32:53 +0000 (-0400) Subject: move the stderr/stdout closing to the ceph-deploy executable X-Git-Tag: v1.5.12~8^2~1 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=cf2b8b104b02ee532cb81259303b1d46cdd44703;p=ceph-deploy.git move the stderr/stdout closing to the ceph-deploy executable Signed-off-by: Alfredo Deza --- diff --git a/ceph_deploy/util/decorators.py b/ceph_deploy/util/decorators.py index 4c72bdc..7589deb 100644 --- a/ceph_deploy/util/decorators.py +++ b/ceph_deploy/util/decorators.py @@ -1,5 +1,4 @@ import logging -import os import sys import traceback from functools import wraps diff --git a/scripts/ceph-deploy b/scripts/ceph-deploy index cc8dd62..5e2d153 100755 --- a/scripts/ceph-deploy +++ b/scripts/ceph-deploy @@ -18,4 +18,18 @@ elif os.path.exists('/usr/lib/python2.6/site-packages/ceph_deploy'): from ceph_deploy.cli import main if __name__ == '__main__': - sys.exit(main()) + try: + sys.exit(main()) + finally: + # This block is crucial to avoid having issues with + # Python spitting non-sense thread exceptions. We have already + # handled what we could, so close stderr and stdout. + if not os.environ.get('CEPH_DEPLOY_TEST'): + try: + sys.stdout.close() + except: + pass + try: + sys.stderr.close() + except: + pass