summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--glanceclient/common/http.py3
-rw-r--r--glanceclient/shell.py8
-rw-r--r--glanceclient/v1/client.py5
3 files changed, 12 insertions, 4 deletions
diff --git a/glanceclient/common/http.py b/glanceclient/common/http.py
index fb73e13..0892a4d 100644
--- a/glanceclient/common/http.py
+++ b/glanceclient/common/http.py
@@ -29,13 +29,14 @@ USER_AGENT = 'python-glanceclient'
class HTTPClient(httplib2.Http):
- def __init__(self, endpoint, token=None, timeout=600):
+ def __init__(self, endpoint, token=None, timeout=600, insecure=False):
super(HTTPClient, self).__init__(timeout=timeout)
self.endpoint = endpoint
self.auth_token = token
# httplib2 overrides
self.force_exception_to_status_code = True
+ self.disable_ssl_certificate_validation = insecure
def http_log(self, args, kwargs, resp, body):
if os.environ.get('GLANCECLIENT_DEBUG', False):
diff --git a/glanceclient/shell.py b/glanceclient/shell.py
index 2f54cc1..ee002f5 100644
--- a/glanceclient/shell.py
+++ b/glanceclient/shell.py
@@ -53,6 +53,11 @@ class OpenStackImagesShell(object):
action='store_true',
help=argparse.SUPPRESS)
+ parser.add_argument('--insecure',
+ default=False,
+ action='store_true',
+ help=argparse.SUPPRESS)
+
parser.add_argument('--os-username',
default=utils.env('OS_USERNAME'),
help='Defaults to env[OS_USERNAME]')
@@ -221,7 +226,8 @@ class OpenStackImagesShell(object):
}
endpoint, token = self._authenticate(**kwargs)
- image_service = client_v1.Client(endpoint, token)
+ image_service = client_v1.Client(endpoint, token,
+ insecure=args.insecure)
try:
args.func(image_service, args)
diff --git a/glanceclient/v1/client.py b/glanceclient/v1/client.py
index 6671c7a..cad967d 100644
--- a/glanceclient/v1/client.py
+++ b/glanceclient/v1/client.py
@@ -33,8 +33,9 @@ class Client(http.HTTPClient):
http requests. (optional)
"""
- def __init__(self, endpoint, token=None, timeout=600):
+ def __init__(self, endpoint, token=None, timeout=600, insecure=False):
""" Initialize a new client for the Images v1 API. """
- super(Client, self).__init__(endpoint, token=token, timeout=timeout)
+ super(Client, self).__init__(endpoint, token=token,
+ timeout=timeout, insecure=insecure)
self.images = images.ImageManager(self)
self.image_members = image_members.ImageMemberManager(self)