summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorZuul <zuul@review.opendev.org>2019-07-15 13:11:55 +0000
committerGerrit Code Review <review@openstack.org>2019-07-15 13:11:55 +0000
commit0b02be574322374bf1975be1ea38526764edd843 (patch)
tree0faa68af6373160ecee0399342a3650b7f1cdec3
parentca1a3895f24d430daf8f9566cf6f743885ff2bff (diff)
parent81ec72ecf8c32b409afedc60e013f9b4c47d5bae (diff)
downloadpython-novaclient-0b02be574322374bf1975be1ea38526764edd843.tar.gz
Merge "Remove deprecated methods and properties"
-rw-r--r--novaclient/client.py23
-rw-r--r--novaclient/exceptions.py36
-rw-r--r--novaclient/tests/unit/test_client.py20
-rw-r--r--novaclient/v2/client.py39
-rw-r--r--releasenotes/notes/remove-deprecated-methods-train-c450fe317c90d7f0.yaml24
5 files changed, 27 insertions, 115 deletions
diff --git a/novaclient/client.py b/novaclient/client.py
index 2808428e..4b3e2281 100644
--- a/novaclient/client.py
+++ b/novaclient/client.py
@@ -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.
diff --git a/novaclient/exceptions.py b/novaclient/exceptions.py
index a7046d33..4c0a5d8d 100644
--- a/novaclient/exceptions.py
+++ b/novaclient/exceptions.py
@@ -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."""
diff --git a/novaclient/tests/unit/test_client.py b/novaclient/tests/unit/test_client.py
index 3411eb50..6b348d1b 100644
--- a/novaclient/tests/unit/test_client.py
+++ b/novaclient/tests/unit/test_client.py
@@ -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):
diff --git a/novaclient/v2/client.py b/novaclient/v2/client.py
index 54abcf27..cec9f2f6 100644
--- a/novaclient/v2/client.py
+++ b/novaclient/v2/client.py
@@ -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."))
diff --git a/releasenotes/notes/remove-deprecated-methods-train-c450fe317c90d7f0.yaml b/releasenotes/notes/remove-deprecated-methods-train-c450fe317c90d7f0.yaml
new file mode 100644
index 00000000..b8a1d531
--- /dev/null
+++ b/releasenotes/notes/remove-deprecated-methods-train-c450fe317c90d7f0.yaml
@@ -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.