Fix --debug CLI option
The --debug argument has been ignored since httplib2 was replaced with httplib. This re-enables the --debug flag as an equivalent to the env var GLANCECLIENT_DEBUG. Fixes bug 1030700 Change-Id: Ib653049eea2f18c4cc2f8f8aac7884245afd0f04
This commit is contained in:
parent
1e744f162e
commit
158f7ccd74
@ -5,7 +5,6 @@ OpenStack Client interface. Handles the REST calls and responses.
|
|||||||
import copy
|
import copy
|
||||||
import httplib
|
import httplib
|
||||||
import logging
|
import logging
|
||||||
import os
|
|
||||||
import urlparse
|
import urlparse
|
||||||
|
|
||||||
|
|
||||||
@ -48,13 +47,6 @@ class HTTPClient(object):
|
|||||||
return self.connection_class(*self.endpoint)
|
return self.connection_class(*self.endpoint)
|
||||||
|
|
||||||
def http_log(self, args, kwargs, resp):
|
def http_log(self, args, kwargs, resp):
|
||||||
if os.environ.get('GLANCECLIENT_DEBUG', False):
|
|
||||||
ch = logging.StreamHandler()
|
|
||||||
logger.setLevel(logging.DEBUG)
|
|
||||||
logger.addHandler(ch)
|
|
||||||
elif not logger.isEnabledFor(logging.DEBUG):
|
|
||||||
return
|
|
||||||
|
|
||||||
string_parts = ['curl -i']
|
string_parts = ['curl -i']
|
||||||
for element in args:
|
for element in args:
|
||||||
if element in ('GET', 'POST'):
|
if element in ('GET', 'POST'):
|
||||||
|
@ -18,6 +18,7 @@ Command-line interface to the OpenStack Images API.
|
|||||||
"""
|
"""
|
||||||
|
|
||||||
import argparse
|
import argparse
|
||||||
|
import logging
|
||||||
import re
|
import re
|
||||||
import sys
|
import sys
|
||||||
|
|
||||||
@ -47,9 +48,9 @@ class OpenStackImagesShell(object):
|
|||||||
)
|
)
|
||||||
|
|
||||||
parser.add_argument('--debug',
|
parser.add_argument('--debug',
|
||||||
default=False,
|
default=bool(utils.env('GLANCECLIENT_DEBUG')),
|
||||||
action='store_true',
|
action='store_true',
|
||||||
help=argparse.SUPPRESS)
|
help='Defaults to env[GLANCECLIENT_DEBUG]')
|
||||||
|
|
||||||
parser.add_argument('--insecure',
|
parser.add_argument('--insecure',
|
||||||
default=False,
|
default=False,
|
||||||
@ -238,6 +239,10 @@ class OpenStackImagesShell(object):
|
|||||||
self.do_help(args)
|
self.do_help(args)
|
||||||
return 0
|
return 0
|
||||||
|
|
||||||
|
LOG = logging.getLogger('glanceclient')
|
||||||
|
LOG.addHandler(logging.StreamHandler())
|
||||||
|
LOG.setLevel(logging.DEBUG if args.debug else logging.INFO)
|
||||||
|
|
||||||
auth_reqd = (utils.is_authentication_required(args.func) and
|
auth_reqd = (utils.is_authentication_required(args.func) and
|
||||||
not (args.os_auth_token and args.os_image_url))
|
not (args.os_auth_token and args.os_image_url))
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user