diff options
author | Jenkins <jenkins@review.openstack.org> | 2015-08-25 23:31:59 +0000 |
---|---|---|
committer | Gerrit Code Review <review@openstack.org> | 2015-08-25 23:32:00 +0000 |
commit | 0abee2c18f8b65a249a4780bf00e2ad9792a758d (patch) | |
tree | c0f5606307181ef986a30d0f05f3fbb22ed2dd49 | |
parent | 6a2a44eeee2d8aac08e34e938c53cf156e3c8de8 (diff) | |
parent | 4e4dedec6ea8fd71354772552166255ddf39abed (diff) | |
download | python-keystoneclient-0abee2c18f8b65a249a4780bf00e2ad9792a758d.tar.gz |
Merge "Deprecate create v3 Client without session"
-rw-r--r-- | keystoneclient/tests/unit/v3/utils.py | 9 | ||||
-rw-r--r-- | keystoneclient/v3/client.py | 14 |
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) |