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:
@@ -129,9 +129,12 @@ class TestCase(UnauthenticatedTestCase):
|
|||||||
|
|
||||||
def setUp(self):
|
def setUp(self):
|
||||||
super(TestCase, self).setUp()
|
super(TestCase, self).setUp()
|
||||||
self.client = client.Client(token=self.TEST_TOKEN,
|
|
||||||
auth_url=self.TEST_URL,
|
# Creating a Client not using session is deprecated.
|
||||||
endpoint=self.TEST_URL)
|
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):
|
def stub_auth(self, subject_token=None, **kwargs):
|
||||||
if not subject_token:
|
if not subject_token:
|
||||||
|
@@ -14,6 +14,7 @@
|
|||||||
# under the License.
|
# under the License.
|
||||||
|
|
||||||
import logging
|
import logging
|
||||||
|
import warnings
|
||||||
|
|
||||||
from oslo_serialization import jsonutils
|
from oslo_serialization import jsonutils
|
||||||
|
|
||||||
@@ -83,6 +84,12 @@ class Client(httpclient.HTTPClient):
|
|||||||
:param integer timeout: Allows customization of the timeout for client
|
:param integer timeout: Allows customization of the timeout for client
|
||||||
http requests. (optional)
|
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::
|
Example::
|
||||||
|
|
||||||
>>> from keystoneclient.v3 import client
|
>>> from keystoneclient.v3 import client
|
||||||
@@ -182,6 +189,13 @@ EndpointPolicyManager`
|
|||||||
"""Initialize a new client for the Keystone v3 API."""
|
"""Initialize a new client for the Keystone v3 API."""
|
||||||
super(Client, self).__init__(**kwargs)
|
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.auth = auth.AuthManager(self._adapter)
|
||||||
self.credentials = credentials.CredentialManager(self._adapter)
|
self.credentials = credentials.CredentialManager(self._adapter)
|
||||||
self.ec2 = ec2.EC2Manager(self._adapter)
|
self.ec2 = ec2.EC2Manager(self._adapter)
|
||||||
|
Reference in New Issue
Block a user