Remove deprecated methods and properties
Remove deprecated methods, properties and unused classes. Change-Id: I16e0b6e55a9c9da04c4582f9be672018d37bf368
This commit is contained in:
parent
66611f26d3
commit
81ec72ecf8
@ -85,21 +85,6 @@ class SessionClient(adapter.LegacyJsonAdapter):
|
||||
def reset_timings(self):
|
||||
self.times = []
|
||||
|
||||
@property
|
||||
def management_url(self):
|
||||
self.logger.warning(
|
||||
_("Property `management_url` is deprecated for SessionClient. "
|
||||
"Use `endpoint_override` instead."))
|
||||
return self.endpoint_override
|
||||
|
||||
@management_url.setter
|
||||
def management_url(self, value):
|
||||
self.logger.warning(
|
||||
_("Property `management_url` is deprecated for SessionClient. "
|
||||
"It should be set via `endpoint_override` variable while class"
|
||||
" initialization."))
|
||||
self.endpoint_override = value
|
||||
|
||||
|
||||
def _construct_http_client(api_version=None,
|
||||
auth=None,
|
||||
@ -211,14 +196,6 @@ def _get_client_class_and_version(version):
|
||||
"novaclient.v%s.client.Client" % version.ver_major)
|
||||
|
||||
|
||||
def get_client_class(version):
|
||||
"""Returns Client class based on given version."""
|
||||
warnings.warn(_("'get_client_class' is deprecated. "
|
||||
"Please use `novaclient.client.Client` instead."))
|
||||
_api_version, client_class = _get_client_class_and_version(version)
|
||||
return client_class
|
||||
|
||||
|
||||
def _check_arguments(kwargs, release, deprecated_name, right_name=None):
|
||||
"""Process deprecation of arguments.
|
||||
|
||||
|
@ -55,46 +55,10 @@ class CommandError(Exception):
|
||||
pass
|
||||
|
||||
|
||||
class AuthorizationFailure(Exception):
|
||||
pass
|
||||
|
||||
|
||||
class NoUniqueMatch(Exception):
|
||||
pass
|
||||
|
||||
|
||||
class NoTokenLookupException(Exception):
|
||||
"""This form of authentication does not support looking up
|
||||
endpoints from an existing token.
|
||||
"""
|
||||
pass
|
||||
|
||||
|
||||
class EndpointNotFound(Exception):
|
||||
"""Could not find Service or Region in Service Catalog."""
|
||||
pass
|
||||
|
||||
|
||||
class AmbiguousEndpoints(Exception):
|
||||
"""Found more than one matching endpoint in Service Catalog."""
|
||||
def __init__(self, endpoints=None):
|
||||
self.endpoints = endpoints
|
||||
|
||||
def __str__(self):
|
||||
return "AmbiguousEndpoints: %s" % repr(self.endpoints)
|
||||
|
||||
|
||||
class ConnectionRefused(Exception):
|
||||
"""
|
||||
Connection refused: the server refused the connection.
|
||||
"""
|
||||
def __init__(self, response=None):
|
||||
self.response = response
|
||||
|
||||
def __str__(self):
|
||||
return "ConnectionRefused: %s" % repr(self.response)
|
||||
|
||||
|
||||
class ResourceInErrorState(Exception):
|
||||
"""Resource is in the error state."""
|
||||
|
||||
|
@ -26,26 +26,6 @@ from novaclient.tests.unit import utils
|
||||
import novaclient.v2.client
|
||||
|
||||
|
||||
class ClientTest(utils.TestCase):
|
||||
def test_get_client_class_v2(self):
|
||||
output = novaclient.client.get_client_class('2')
|
||||
self.assertEqual(output, novaclient.v2.client.Client)
|
||||
|
||||
def test_get_client_class_v2_int(self):
|
||||
output = novaclient.client.get_client_class(2)
|
||||
self.assertEqual(output, novaclient.v2.client.Client)
|
||||
|
||||
def test_get_client_class_unknown(self):
|
||||
self.assertRaises(novaclient.exceptions.UnsupportedVersion,
|
||||
novaclient.client.get_client_class, '0')
|
||||
|
||||
def test_get_client_class_latest(self):
|
||||
self.assertRaises(novaclient.exceptions.UnsupportedVersion,
|
||||
novaclient.client.get_client_class, 'latest')
|
||||
self.assertRaises(novaclient.exceptions.UnsupportedVersion,
|
||||
novaclient.client.get_client_class, '2.latest')
|
||||
|
||||
|
||||
class SessionClientTest(utils.TestCase):
|
||||
|
||||
def test_timings(self):
|
||||
|
@ -223,50 +223,17 @@ class Client(object):
|
||||
def api_version(self, value):
|
||||
self.client.api_version = value
|
||||
|
||||
@property
|
||||
def projectid(self):
|
||||
self.logger.warning(_("Property 'projectid' is deprecated since "
|
||||
"Ocata. Use 'project_name' instead."))
|
||||
return self.project_name
|
||||
|
||||
@property
|
||||
def tenant_id(self):
|
||||
self.logger.warning(_("Property 'tenant_id' is deprecated since "
|
||||
"Ocata. Use 'project_id' instead."))
|
||||
return self.project_id
|
||||
|
||||
def __enter__(self):
|
||||
self.logger.warning(_("NovaClient instance can't be used as a "
|
||||
"context manager since Ocata (deprecated "
|
||||
"behaviour) since it is redundant in case of "
|
||||
"SessionClient."))
|
||||
return self
|
||||
raise exceptions.InvalidUsage(_(
|
||||
"NovaClient instance can't be used as a context manager "
|
||||
"since it is redundant in case of SessionClient."))
|
||||
|
||||
def __exit__(self, t, v, tb):
|
||||
# do not do anything
|
||||
pass
|
||||
|
||||
def set_management_url(self, url):
|
||||
self.logger.warning(
|
||||
_("Method `set_management_url` is deprecated since Ocata. "
|
||||
"Use `endpoint_override` argument instead while initializing "
|
||||
"novaclient's instance."))
|
||||
self.client.set_management_url(url)
|
||||
|
||||
def get_timings(self):
|
||||
return self.client.get_timings()
|
||||
|
||||
def reset_timings(self):
|
||||
self.client.reset_timings()
|
||||
|
||||
def authenticate(self):
|
||||
"""Authenticate against the server.
|
||||
|
||||
Normally this is called automatically when you first access the API,
|
||||
but you can call this method to force authentication right now.
|
||||
|
||||
Returns on success; raises :exc:`exceptions.Unauthorized` if the
|
||||
credentials are wrong.
|
||||
"""
|
||||
self.logger.warning(_(
|
||||
"Method 'authenticate' is deprecated since Ocata."))
|
||||
|
@ -0,0 +1,24 @@
|
||||
---
|
||||
upgrade:
|
||||
- |
|
||||
The following properties have been removed.
|
||||
|
||||
- ``novaclient.client.SessionClient``
|
||||
|
||||
- ``management_url``
|
||||
|
||||
- ``novaclient.v2.client.Client``
|
||||
|
||||
- ``projectid``
|
||||
- ``tenant_id``
|
||||
|
||||
The following methods have been removed.
|
||||
|
||||
- ``novaclient.client.get_client_class``
|
||||
- ``novaclient.v2.client.Client``
|
||||
|
||||
- ``set_management_url``
|
||||
- ``authenticate``
|
||||
|
||||
The ``novaclient.v2.client.Client.__enter__`` method now raises
|
||||
the ``InvalidUsage`` runtime error.
|
Loading…
Reference in New Issue
Block a user