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:
@@ -58,9 +58,7 @@ class BaseIdentityPlugin(base.BaseAuthPlugin):
|
|||||||
self._username = username
|
self._username = username
|
||||||
self._password = password
|
self._password = password
|
||||||
self._token = token
|
self._token = token
|
||||||
# NOTE(jamielennox): DEPRECATED. The following should not really be set
|
self._trust_id = trust_id
|
||||||
# here but handled by the individual auth plugin.
|
|
||||||
self.trust_id = trust_id
|
|
||||||
|
|
||||||
@property
|
@property
|
||||||
def username(self):
|
def username(self):
|
||||||
@@ -134,6 +132,30 @@ class BaseIdentityPlugin(base.BaseAuthPlugin):
|
|||||||
|
|
||||||
self._token = value
|
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
|
@abc.abstractmethod
|
||||||
def get_auth_ref(self, session, **kwargs):
|
def get_auth_ref(self, session, **kwargs):
|
||||||
"""Obtain a token from an OpenStack Identity Service.
|
"""Obtain a token from an OpenStack Identity Service.
|
||||||
|
@@ -72,6 +72,16 @@ class BaseGenericPlugin(base.BaseIdentityPlugin):
|
|||||||
|
|
||||||
self._plugin = None
|
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
|
@abc.abstractmethod
|
||||||
def create_plugin(self, session, version, url, raw_status=None):
|
def create_plugin(self, session, version, url, raw_status=None):
|
||||||
"""Create a plugin from the given paramters.
|
"""Create a plugin from the given paramters.
|
||||||
|
@@ -57,10 +57,20 @@ class Auth(base.BaseIdentityPlugin):
|
|||||||
super(Auth, self).__init__(auth_url=auth_url,
|
super(Auth, self).__init__(auth_url=auth_url,
|
||||||
reauthenticate=reauthenticate)
|
reauthenticate=reauthenticate)
|
||||||
|
|
||||||
self.trust_id = trust_id
|
self._trust_id = trust_id
|
||||||
self.tenant_id = tenant_id
|
self.tenant_id = tenant_id
|
||||||
self.tenant_name = tenant_name
|
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):
|
def get_auth_ref(self, session, **kwargs):
|
||||||
headers = {'Accept': 'application/json'}
|
headers = {'Accept': 'application/json'}
|
||||||
url = self.auth_url.rstrip('/') + '/tokens'
|
url = self.auth_url.rstrip('/') + '/tokens'
|
||||||
|
@@ -59,7 +59,7 @@ class BaseAuth(base.BaseIdentityPlugin):
|
|||||||
include_catalog=True):
|
include_catalog=True):
|
||||||
super(BaseAuth, self).__init__(auth_url=auth_url,
|
super(BaseAuth, self).__init__(auth_url=auth_url,
|
||||||
reauthenticate=reauthenticate)
|
reauthenticate=reauthenticate)
|
||||||
self.trust_id = trust_id
|
self._trust_id = trust_id
|
||||||
self.domain_id = domain_id
|
self.domain_id = domain_id
|
||||||
self.domain_name = domain_name
|
self.domain_name = domain_name
|
||||||
self.project_id = project_id
|
self.project_id = project_id
|
||||||
@@ -68,6 +68,16 @@ class BaseAuth(base.BaseIdentityPlugin):
|
|||||||
self.project_domain_name = project_domain_name
|
self.project_domain_name = project_domain_name
|
||||||
self.include_catalog = include_catalog
|
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
|
@property
|
||||||
def token_url(self):
|
def token_url(self):
|
||||||
"""The full URL where we will send authentication data."""
|
"""The full URL where we will send authentication data."""
|
||||||
|
Reference in New Issue
Block a user