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:
Stuart McLaren
2016-03-30 11:56:56 +00:00
parent 04e1ea73a5
commit d0ec3a7ebb
3 changed files with 49 additions and 12 deletions
+8
View File
@@ -467,6 +467,14 @@ def endpoint_version_from_url(endpoint, default_version=None):
return None, default_version
def debug_enabled(argv):
if bool(env('GLANCECLIENT_DEBUG')) is True:
return True
if '--debug' in argv or '-d' in argv:
return True
return False
class IterableWithLength(object):
def __init__(self, iterable, length):
self.iterable = iterable