Signed-off-by: Alfredo Deza <alfredo.deza@inktank.com>
import logging
-import os
import sys
import traceback
from functools import wraps
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