Re-enable stacktracing when --debug is used
Commit 1f89beb609 introduced the behaviour
that a stacktrace is printed if an exception is encountered.
This helped make the client more supportable:
$ glance --debug image-list
.
.
.
File "glanceclient/common/http.py", line 337, in get_http_client
xxx
NameError: global name 'xxx' is not defined
global name 'xxx' is not defined
The behaviour was lost at some point. This patch re-enables it.
Change-Id: I25fc8624797909d606590747f54b9cf649ade079
Closes-bug: 1563830
This commit is contained in:
+2
-12
@@ -489,18 +489,12 @@ class OpenStackImagesShell(object):
|
||||
try:
|
||||
return self.get_subcommand_parser(api_version)
|
||||
except ImportError as e:
|
||||
if options.debug:
|
||||
traceback.print_exc()
|
||||
if not str(e):
|
||||
# Add a generic import error message if the raised
|
||||
# ImportError has none.
|
||||
raise ImportError('Unable to import module. Re-run '
|
||||
'with --debug for more info.')
|
||||
raise
|
||||
except Exception:
|
||||
if options.debug:
|
||||
traceback.print_exc()
|
||||
raise
|
||||
|
||||
# Parse args once to find version
|
||||
|
||||
@@ -595,12 +589,6 @@ class OpenStackImagesShell(object):
|
||||
args.func(client, args)
|
||||
except exc.Unauthorized:
|
||||
raise exc.CommandError("Invalid OpenStack Identity credentials.")
|
||||
except Exception:
|
||||
# NOTE(kragniz) Print any exceptions raised to stderr if the
|
||||
# --debug flag is set
|
||||
if args.debug:
|
||||
traceback.print_exc()
|
||||
raise
|
||||
finally:
|
||||
if profile:
|
||||
trace_id = osprofiler_profiler.get().get_base_id()
|
||||
@@ -671,4 +659,6 @@ def main():
|
||||
except KeyboardInterrupt:
|
||||
utils.exit('... terminating glance client', exit_code=130)
|
||||
except Exception as e:
|
||||
if utils.debug_enabled(argv) is True:
|
||||
traceback.print_exc()
|
||||
utils.exit(encodeutils.exception_to_unicode(e))
|
||||
|
||||
Reference in New Issue
Block a user