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
This commit is contained in:
parent
3d1ad74ff0
commit
28c003dc11
@ -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.
|
||||
|
@ -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
|
||||
|
@ -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.
|
||||
|
||||
|
@ -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)
|
||||
|
@ -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'])
|
||||
|
Loading…
Reference in New Issue
Block a user