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:

committed by
Evilien Macchi

parent
d077cb33d8
commit
1034d65378
@@ -13,8 +13,6 @@
|
|||||||
# under the License.
|
# under the License.
|
||||||
#
|
#
|
||||||
|
|
||||||
import sys
|
|
||||||
import traceback
|
|
||||||
|
|
||||||
"""Exception definitions"""
|
"""Exception definitions"""
|
||||||
|
|
||||||
@@ -38,7 +36,6 @@ class NotFound(Exception):
|
|||||||
class DeploymentError(RuntimeError):
|
class DeploymentError(RuntimeError):
|
||||||
"""Deployment failed"""
|
"""Deployment failed"""
|
||||||
def __init__(self, *args, **kwargs):
|
def __init__(self, *args, **kwargs):
|
||||||
traceback.format_exception(*sys.exc_info())
|
|
||||||
super(RuntimeError, self).__init__(*args, **kwargs)
|
super(RuntimeError, self).__init__(*args, **kwargs)
|
||||||
|
|
||||||
|
|
||||||
|
@@ -27,6 +27,7 @@ import subprocess
|
|||||||
import sys
|
import sys
|
||||||
import tarfile
|
import tarfile
|
||||||
import tempfile
|
import tempfile
|
||||||
|
import traceback
|
||||||
import yaml
|
import yaml
|
||||||
|
|
||||||
from cliff import command
|
from cliff import command
|
||||||
@@ -1120,6 +1121,7 @@ class Deploy(command.Command):
|
|||||||
rc = self._launch_ansible_deploy(self.ansible_dir)
|
rc = self._launch_ansible_deploy(self.ansible_dir)
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
self.log.error("Exception: %s" % six.text_type(e))
|
self.log.error("Exception: %s" % six.text_type(e))
|
||||||
|
self.log.error(traceback.print_exc())
|
||||||
raise exceptions.DeploymentError(six.text_type(e))
|
raise exceptions.DeploymentError(six.text_type(e))
|
||||||
finally:
|
finally:
|
||||||
if not parsed_args.keep_running:
|
if not parsed_args.keep_running:
|
||||||
|
Reference in New Issue
Block a user