Deprecate create v3 Client without session
There was a comment to deprecate creating a v3 Client without a session. bp deprecations Change-Id: Ifc3fa9ffef12554646ca80f04527de757df3aa95
This commit is contained in:
parent
b94a61012e
commit
4e4dedec6e
|
@ -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:
|
||||
|
|
|
@ -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)
|
||||
|
|
Loading…
Reference in New Issue