Proper deprecation for BaseIdentityPlugin trust_id property

BaseIdentityPlugin's trust_id property wasn't properly deprecated
since all it had was a comment in the code. Proper deprecation
requires use of warnings and documentation.

Where the plugins already provide their own trust_id, the
property needs to be un-deprecated.

bp deprecations

Change-Id: I15d4e019bfc5542990120ba39be65ad83cf040d5
This commit is contained in:
Brant Knudson 2015-07-24 13:57:12 -05:00
parent 799e1faa50
commit b1496abbb7
4 changed files with 57 additions and 5 deletions
keystoneclient/auth/identity

@ -58,9 +58,7 @@ class BaseIdentityPlugin(base.BaseAuthPlugin):
self._username = username
self._password = password
self._token = token
# NOTE(jamielennox): DEPRECATED. The following should not really be set
# here but handled by the individual auth plugin.
self.trust_id = trust_id
self._trust_id = trust_id
@property
def username(self):
@ -134,6 +132,30 @@ class BaseIdentityPlugin(base.BaseAuthPlugin):
self._token = value
@property
def trust_id(self):
"""Deprecated as of the 1.7.0 release and may be removed in the 2.0.0
release.
"""
warnings.warn(
'trust_id is deprecated as of the 1.7.0 release and may be '
'removed in the 2.0.0 release.', DeprecationWarning)
return self._trust_id
@trust_id.setter
def trust_id(self, value):
"""Deprecated as of the 1.7.0 release and may be removed in the 2.0.0
release.
"""
warnings.warn(
'trust_id is deprecated as of the 1.7.0 release and may be '
'removed in the 2.0.0 release.', DeprecationWarning)
self._trust_id = value
@abc.abstractmethod
def get_auth_ref(self, session, **kwargs):
"""Obtain a token from an OpenStack Identity Service.

@ -72,6 +72,16 @@ class BaseGenericPlugin(base.BaseIdentityPlugin):
self._plugin = None
@property
def trust_id(self):
# Override to remove deprecation.
return self._trust_id
@trust_id.setter
def trust_id(self, value):
# Override to remove deprecation.
self._trust_id = value
@abc.abstractmethod
def create_plugin(self, session, version, url, raw_status=None):
"""Create a plugin from the given paramters.

@ -57,10 +57,20 @@ class Auth(base.BaseIdentityPlugin):
super(Auth, self).__init__(auth_url=auth_url,
reauthenticate=reauthenticate)
self.trust_id = trust_id
self._trust_id = trust_id
self.tenant_id = tenant_id
self.tenant_name = tenant_name
@property
def trust_id(self):
# Override to remove deprecation.
return self._trust_id
@trust_id.setter
def trust_id(self, value):
# Override to remove deprecation.
self._trust_id = value
def get_auth_ref(self, session, **kwargs):
headers = {'Accept': 'application/json'}
url = self.auth_url.rstrip('/') + '/tokens'

@ -59,7 +59,7 @@ class BaseAuth(base.BaseIdentityPlugin):
include_catalog=True):
super(BaseAuth, self).__init__(auth_url=auth_url,
reauthenticate=reauthenticate)
self.trust_id = trust_id
self._trust_id = trust_id
self.domain_id = domain_id
self.domain_name = domain_name
self.project_id = project_id
@ -68,6 +68,16 @@ class BaseAuth(base.BaseIdentityPlugin):
self.project_domain_name = project_domain_name
self.include_catalog = include_catalog
@property
def trust_id(self):
# Override to remove deprecation.
return self._trust_id
@trust_id.setter
def trust_id(self, value):
# Override to remove deprecation.
self._trust_id = value
@property
def token_url(self):
"""The full URL where we will send authentication data."""