summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBrant Knudson <bknudson@us.ibm.com>2015-07-26 08:55:30 -0500
committerBrant Knudson <bknudson@us.ibm.com>2015-08-13 19:01:42 -0500
commit4e4dedec6ea8fd71354772552166255ddf39abed (patch)
tree08202b430d13bc4c4666937486fc241433382a32
parentb94a61012ed9749f818e88366c57aa566a39101d (diff)
downloadpython-keystoneclient-4e4dedec6ea8fd71354772552166255ddf39abed.tar.gz
Deprecate create v3 Client without session
There was a comment to deprecate creating a v3 Client without a session. bp deprecations Change-Id: Ifc3fa9ffef12554646ca80f04527de757df3aa95
-rw-r--r--keystoneclient/tests/unit/v3/utils.py9
-rw-r--r--keystoneclient/v3/client.py14
2 files changed, 20 insertions, 3 deletions
diff --git a/keystoneclient/tests/unit/v3/utils.py b/keystoneclient/tests/unit/v3/utils.py
index 442c3a9..1705e9d 100644
--- a/keystoneclient/tests/unit/v3/utils.py
+++ b/keystoneclient/tests/unit/v3/utils.py
@@ -129,9 +129,12 @@ class TestCase(UnauthenticatedTestCase):
def setUp(self):
super(TestCase, self).setUp()
- self.client = client.Client(token=self.TEST_TOKEN,
- auth_url=self.TEST_URL,
- endpoint=self.TEST_URL)
+
+ # Creating a Client not using session is deprecated.
+ with self.deprecations.expect_deprecations_here():
+ self.client = client.Client(token=self.TEST_TOKEN,
+ auth_url=self.TEST_URL,
+ endpoint=self.TEST_URL)
def stub_auth(self, subject_token=None, **kwargs):
if not subject_token:
diff --git a/keystoneclient/v3/client.py b/keystoneclient/v3/client.py
index 3d37e3c..38be932 100644
--- a/keystoneclient/v3/client.py
+++ b/keystoneclient/v3/client.py
@@ -14,6 +14,7 @@
# under the License.
import logging
+import warnings
from oslo_serialization import jsonutils
@@ -83,6 +84,12 @@ class Client(httpclient.HTTPClient):
:param integer timeout: Allows customization of the timeout for client
http requests. (optional)
+ .. warning::
+
+ Constructing an instance of this class without a session is
+ deprecated as of the 1.7.0 release and will be removed in the
+ 2.0.0 release.
+
Example::
>>> from keystoneclient.v3 import client
@@ -182,6 +189,13 @@ EndpointPolicyManager`
"""Initialize a new client for the Keystone v3 API."""
super(Client, self).__init__(**kwargs)
+ if not kwargs.get('session'):
+ warnings.warn(
+ 'Constructing an instance of the '
+ 'keystoneclient.v3.client.Client class without a session is '
+ 'deprecated as of the 1.7.0 release and may be removed in '
+ 'the 2.0.0 release.', DeprecationWarning)
+
self.auth = auth.AuthManager(self._adapter)
self.credentials = credentials.CredentialManager(self._adapter)
self.ec2 = ec2.EC2Manager(self._adapter)