From 1034d65378557cfff970f7c88f177875ead4b0ba Mon Sep 17 00:00:00 2001 From: James Slagle Date: Fri, 20 Jul 2018 11:58:36 -0400 Subject: [PATCH] Log tracebacks Always log the traceback for unexpected exceptions. It's very difficult to tell where the error came from without the traceback. It seems this was the intent with Iad9de7fab0ee740bd20f8facd49f36e6f18d2fb1, but traceback.format_exception doesn't actually print/log anything, it returns a list of strings, which are just lost if not actually saved/logged. Instead use traceback.print_exc in the main handler to show the traceback. Change-Id: If84a41907e1fc782bd5a4608f445e75aa3a5d2fb --- tripleoclient/exceptions.py | 3 --- tripleoclient/v1/tripleo_deploy.py | 2 ++ 2 files changed, 2 insertions(+), 3 deletions(-) diff --git a/tripleoclient/exceptions.py b/tripleoclient/exceptions.py index c450fd60f..77fa50f53 100644 --- a/tripleoclient/exceptions.py +++ b/tripleoclient/exceptions.py @@ -13,8 +13,6 @@ # under the License. # -import sys -import traceback """Exception definitions""" @@ -38,7 +36,6 @@ class NotFound(Exception): class DeploymentError(RuntimeError): """Deployment failed""" def __init__(self, *args, **kwargs): - traceback.format_exception(*sys.exc_info()) super(RuntimeError, self).__init__(*args, **kwargs) diff --git a/tripleoclient/v1/tripleo_deploy.py b/tripleoclient/v1/tripleo_deploy.py index 7c6b1af44..45998eacd 100644 --- a/tripleoclient/v1/tripleo_deploy.py +++ b/tripleoclient/v1/tripleo_deploy.py @@ -27,6 +27,7 @@ import subprocess import sys import tarfile import tempfile +import traceback import yaml from cliff import command @@ -1120,6 +1121,7 @@ class Deploy(command.Command): rc = self._launch_ansible_deploy(self.ansible_dir) except Exception as e: self.log.error("Exception: %s" % six.text_type(e)) + self.log.error(traceback.print_exc()) raise exceptions.DeploymentError(six.text_type(e)) finally: if not parsed_args.keep_running: