Proper deprecation for HTTPClient.tenant_id|name

HTTPClient tenant_id and tenant_name properties weren't properly
deprecated since they were only mentioned in the docstring. Proper
deprecation requires use of warnings/debtcollector and
documentation.

bp deprecations

Change-Id: I3c2f87df14bc9f8ffd82b99919fd1048123d0669
This commit is contained in:
Brant Knudson
2015-07-24 15:34:27 -05:00
parent 1721e01743
commit ada04acf4d

View File

@@ -20,6 +20,7 @@ OpenStack Client interface. Handles the REST calls and responses.
""" """
import logging import logging
import warnings
from debtcollector import removals from debtcollector import removals
from debtcollector import renames from debtcollector import renames
@@ -424,15 +425,35 @@ class HTTPClient(baseclient.Client, base.BaseAuthPlugin):
@property @property
def tenant_id(self): def tenant_id(self):
"""Provide read-only backwards compatibility for tenant_id. """Provide read-only backwards compatibility for tenant_id.
This is deprecated, use project_id instead.
.. warning::
This is deprecated as of the 1.7.0 release in favor of project_id
and may be removed in the 2.0.0 release.
""" """
warnings.warn(
'tenant_id is deprecated as of the 1.7.0 release in favor of '
'project_id and may be removed in the 2.0.0 release.',
DeprecationWarning)
return self.project_id return self.project_id
@property @property
def tenant_name(self): def tenant_name(self):
"""Provide read-only backwards compatibility for tenant_name. """Provide read-only backwards compatibility for tenant_name.
This is deprecated, use project_name instead.
.. warning::
This is deprecated as of the 1.7.0 release in favor of project_name
and may be removed in the 2.0.0 release.
""" """
warnings.warn(
'tenant_name is deprecated as of the 1.7.0 release in favor of '
'project_name and may be removed in the 2.0.0 release.',
DeprecationWarning)
return self.project_name return self.project_name
@utils.positional(enforcement=utils.positional.WARN) @utils.positional(enforcement=utils.positional.WARN)