forked from pool/python-glanceclient
We want that OBS-URL: https://build.opensuse.org/request/show/139813 OBS-URL: https://build.opensuse.org/package/show/Cloud:OpenStack:Essex/python-glanceclient?expand=0&rev=1
62 lines
2.5 KiB
Diff
62 lines
2.5 KiB
Diff
Index: python-glanceclient-2012.1+git.1342772282.71a0cae/glanceclient/common/http.py
|
|
===================================================================
|
|
--- python-glanceclient-2012.1+git.1342772282.71a0cae.orig/glanceclient/common/http.py
|
|
+++ python-glanceclient-2012.1+git.1342772282.71a0cae/glanceclient/common/http.py
|
|
@@ -41,11 +41,7 @@ class HTTPClient(httplib2.Http):
|
|
self.disable_ssl_certificate_validation = insecure
|
|
|
|
def http_log(self, args, kwargs, resp, body):
|
|
- if os.environ.get('GLANCECLIENT_DEBUG', False):
|
|
- ch = logging.StreamHandler()
|
|
- logger.setLevel(logging.DEBUG)
|
|
- logger.addHandler(ch)
|
|
- elif not logger.isEnabledFor(logging.DEBUG):
|
|
+ if not logger.isEnabledFor(logging.DEBUG):
|
|
return
|
|
|
|
string_parts = ['curl -i']
|
|
@@ -84,7 +80,7 @@ class HTTPClient(httplib2.Http):
|
|
self.http_log((url, method,), kwargs, resp, body)
|
|
|
|
if 400 <= resp.status < 600:
|
|
- logger.exception("Request returned failure status.")
|
|
+ logger.error("Request returned failure status.")
|
|
raise exc.from_response(resp, body)
|
|
elif resp.status in (301, 302, 305):
|
|
# Redirected. Reissue the request to the new location.
|
|
Index: python-glanceclient-2012.1+git.1342772282.71a0cae/glanceclient/shell.py
|
|
===================================================================
|
|
--- python-glanceclient-2012.1+git.1342772282.71a0cae.orig/glanceclient/shell.py
|
|
+++ python-glanceclient-2012.1+git.1342772282.71a0cae/glanceclient/shell.py
|
|
@@ -19,6 +19,7 @@ Command-line interface to the OpenStack
|
|
|
|
import argparse
|
|
import httplib2
|
|
+import logging
|
|
import re
|
|
import sys
|
|
|
|
@@ -48,9 +49,9 @@ class OpenStackImagesShell(object):
|
|
)
|
|
|
|
parser.add_argument('--debug',
|
|
- default=False,
|
|
+ default=bool(utils.env('GLANCECLIENT_DEBUG')),
|
|
action='store_true',
|
|
- help=argparse.SUPPRESS)
|
|
+ help='Defaults to env[GLANCECLIENT_DEBUG]')
|
|
|
|
parser.add_argument('--insecure',
|
|
default=False,
|
|
@@ -239,6 +240,10 @@ class OpenStackImagesShell(object):
|
|
if args.debug:
|
|
httplib2.debuglevel = 1
|
|
|
|
+ LOG = logging.getLogger('glanceclient')
|
|
+ LOG.addHandler(logging.StreamHandler())
|
|
+ LOG.setLevel(logging.DEBUG if args.debug else logging.INFO)
|
|
+
|
|
# Short-circuit and deal with help command right away.
|
|
if args.func == self.do_help:
|
|
self.do_help(args)
|