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
This commit is contained in:
parent
d077cb33d8
commit
1034d65378
|
@ -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)
|
||||
|
||||
|
||||
|
|
|
@ -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:
|
||||
|
|
Loading…
Reference in New Issue