From 28c003dc1179ddb3124fd30c6f525dd341ae9213 Mon Sep 17 00:00:00 2001 From: PranaliD Date: Tue, 2 May 2017 16:05:42 +0530 Subject: [PATCH] Removed the --no-ssl-compression parameter which is deprecated --no-ssl-compression is deprecated and no longer used. So, it is removed from the help message. Change-Id: I2b886671a568ed191ee380cf16335ccd9ae85062 Closes-Bug: #1583919 --- doc/source/cli/details.rst | 7 +- glanceclient/common/http.py | 8 -- glanceclient/common/https.py | 86 ------------------- glanceclient/shell.py | 9 -- .../tests/functional/test_readonly_glance.py | 9 -- 5 files changed, 1 insertion(+), 118 deletions(-) diff --git a/doc/source/cli/details.rst b/doc/source/cli/details.rst index cb08755a..400c1ed7 100644 --- a/doc/source/cli/details.rst +++ b/doc/source/cli/details.rst @@ -20,7 +20,7 @@ glance usage .. code-block:: console - usage: glance [--version] [-d] [-v] [--get-schema] [--no-ssl-compression] [-f] + usage: glance [--version] [-d] [-v] [--get-schema] [-f] [--os-image-url OS_IMAGE_URL] [--os-image-api-version OS_IMAGE_API_VERSION] [--profile HMAC_KEY] [--key-file OS_KEY] [--ca-file OS_CACERT] @@ -64,11 +64,6 @@ glance optional arguments that generates portions of the help text. Ignored with API version 1. -``--no-ssl-compression`` - **DEPRECATED!** This option is deprecated and not used - anymore. SSL compression should be disabled by default - by the system SSL library. - ``-f, --force`` Prevent select actions from requesting user confirmation. diff --git a/glanceclient/common/http.py b/glanceclient/common/http.py index 35ef282c..fc635fff 100644 --- a/glanceclient/common/http.py +++ b/glanceclient/common/http.py @@ -24,7 +24,6 @@ from oslo_utils import importutils from oslo_utils import netutils import requests import six -import warnings try: import json @@ -146,13 +145,6 @@ class HTTPClient(_BaseHTTPClient): self.timeout = float(kwargs.get('timeout', 600)) if self.endpoint.startswith("https"): - compression = kwargs.get('ssl_compression', True) - - if compression is False: - # Note: This is not seen by default. (python must be - # run with -Wd) - warnings.warn('The "ssl_compression" argument has been ' - 'deprecated.', DeprecationWarning) if kwargs.get('insecure', False) is True: self.session.verify = False diff --git a/glanceclient/common/https.py b/glanceclient/common/https.py index 36015e56..deb7eb03 100644 --- a/glanceclient/common/https.py +++ b/glanceclient/common/https.py @@ -18,17 +18,8 @@ import ssl import struct import OpenSSL -from requests import adapters -from requests import compat -try: - from requests.packages.urllib3 import connectionpool - from requests.packages.urllib3 import poolmanager -except ImportError: - from urllib3 import connectionpool - from urllib3 import poolmanager -from oslo_utils import encodeutils import six # NOTE(jokke): simplified transition to py3, behaves like py2 xrange from six.moves import range @@ -135,83 +126,6 @@ def to_bytes(s): return s -class HTTPSAdapter(adapters.HTTPAdapter): - """This adapter will be used just when ssl compression should be disabled. - - The init method overwrites the default https pool by setting - glanceclient's one. - """ - def __init__(self, *args, **kwargs): - classes_by_scheme = poolmanager.pool_classes_by_scheme - classes_by_scheme["glance+https"] = HTTPSConnectionPool - super(HTTPSAdapter, self).__init__(*args, **kwargs) - - def request_url(self, request, proxies): - # NOTE(flaper87): Make sure the url is encoded, otherwise - # python's standard httplib will fail with a TypeError. - url = super(HTTPSAdapter, self).request_url(request, proxies) - if six.PY2: - url = encodeutils.safe_encode(url) - return url - - def _create_glance_httpsconnectionpool(self, url): - kw = self.poolmanager.connection_pool_kw - # Parse the url to get the scheme, host, and port - parsed = compat.urlparse(url) - # If there is no port specified, we should use the standard HTTPS port - port = parsed.port or 443 - host = parsed.netloc.rsplit(':', 1)[0] - pool = HTTPSConnectionPool(host, port, **kw) - - with self.poolmanager.pools.lock: - self.poolmanager.pools[(parsed.scheme, host, port)] = pool - - return pool - - def get_connection(self, url, proxies=None): - try: - return super(HTTPSAdapter, self).get_connection(url, proxies) - except KeyError: - # NOTE(sigamvirus24): This works around modifying a module global - # which fixes bug #1396550 - # The scheme is most likely glance+https but check anyway - if not url.startswith('glance+https://'): - raise - - return self._create_glance_httpsconnectionpool(url) - - def cert_verify(self, conn, url, verify, cert): - super(HTTPSAdapter, self).cert_verify(conn, url, verify, cert) - conn.ca_certs = verify[0] - conn.insecure = verify[1] - - -class HTTPSConnectionPool(connectionpool.HTTPSConnectionPool): - """A replacement for the default HTTPSConnectionPool. - - HTTPSConnectionPool will be instantiated when a new - connection is requested to the HTTPSAdapter. This - implementation overwrites the _new_conn method and - returns an instances of glanceclient's VerifiedHTTPSConnection - which handles no compression. - - ssl_compression is hard-coded to False because this will - be used just when the user sets --no-ssl-compression. - """ - - scheme = 'glance+https' - - def _new_conn(self): - self.num_connections += 1 - return VerifiedHTTPSConnection(host=self.host, - port=self.port, - key_file=self.key_file, - cert_file=self.cert_file, - cacert=self.ca_certs, - insecure=self.insecure, - ssl_compression=False) - - class OpenSSLConnectionDelegator(object): """An OpenSSL.SSL.Connection delegator. diff --git a/glanceclient/shell.py b/glanceclient/shell.py index 5aaaf394..55862cf7 100644 --- a/glanceclient/shell.py +++ b/glanceclient/shell.py @@ -155,14 +155,6 @@ class OpenStackImagesShell(object): 'of schema that generates portions of the ' 'help text. Ignored with API version 1.') - parser.add_argument('--no-ssl-compression', - dest='ssl_compression', - default=True, action='store_false', - help='DEPRECATED! This option is deprecated ' - 'and not used anymore. SSL compression ' - 'should be disabled by default by the ' - 'system SSL library.') - parser.add_argument('-f', '--force', dest='force', default=False, action='store_true', @@ -434,7 +426,6 @@ class OpenStackImagesShell(object): 'cacert': args.os_cacert, 'cert': args.os_cert, 'key': args.os_key, - 'ssl_compression': args.ssl_compression } else: ks_session = loading.load_session_from_argparse_arguments(args) diff --git a/glanceclient/tests/functional/test_readonly_glance.py b/glanceclient/tests/functional/test_readonly_glance.py index 822bbcc7..ccd49d63 100644 --- a/glanceclient/tests/functional/test_readonly_glance.py +++ b/glanceclient/tests/functional/test_readonly_glance.py @@ -109,12 +109,3 @@ class SimpleReadOnlyGlanceClientTest(base.ClientTestBase): def test_debug_list(self): self.glance('--os-image-api-version 2 image-list', flags='--debug') - - def test_no_ssl_compression(self): - # Test deprecating this hasn't broken anything - out = self.glance('--os-image-api-version 1 ' - '--no-ssl-compression image-list') - endpoints = self.parser.listing(out) - self.assertTableStruct(endpoints, [ - 'ID', 'Name', 'Disk Format', 'Container Format', - 'Size', 'Status'])