Proper deprecation for CredentialManager data argument
CredentialManager's data argument wasn't properly deprecated since the deprecation was only mentioned in the docstring. Proper deprecation requires use of warnings/debtcollector and documentation. bp deprecations Change-Id: Ibdb4bda622119eec963ce5b57673dc01ff279b0e
This commit is contained in:
@@ -42,6 +42,7 @@ class CredentialTests(utils.TestCase, utils.CrudTests):
|
|||||||
def test_create_data_not_blob(self):
|
def test_create_data_not_blob(self):
|
||||||
# Test create operation with previous, deprecated "data" argument,
|
# Test create operation with previous, deprecated "data" argument,
|
||||||
# which should be translated into "blob" at the API call level
|
# which should be translated into "blob" at the API call level
|
||||||
|
self.deprecations.expect_deprecations()
|
||||||
req_ref = self.new_ref()
|
req_ref = self.new_ref()
|
||||||
api_ref = self._ref_data_not_blob(req_ref)
|
api_ref = self._ref_data_not_blob(req_ref)
|
||||||
req_ref.pop('id')
|
req_ref.pop('id')
|
||||||
|
@@ -14,6 +14,8 @@
|
|||||||
# License for the specific language governing permissions and limitations
|
# License for the specific language governing permissions and limitations
|
||||||
# under the License.
|
# under the License.
|
||||||
|
|
||||||
|
from debtcollector import renames
|
||||||
|
|
||||||
from keystoneclient import base
|
from keystoneclient import base
|
||||||
from keystoneclient.i18n import _
|
from keystoneclient.i18n import _
|
||||||
from keystoneclient import utils
|
from keystoneclient import utils
|
||||||
@@ -46,13 +48,13 @@ class CredentialManager(base.CrudManager):
|
|||||||
if blob is not None:
|
if blob is not None:
|
||||||
return blob
|
return blob
|
||||||
elif data is not None:
|
elif data is not None:
|
||||||
# FIXME(shardy): Passing data is deprecated. Provide an
|
|
||||||
# appropriate warning.
|
|
||||||
return data
|
return data
|
||||||
else:
|
else:
|
||||||
raise ValueError(
|
raise ValueError(
|
||||||
_("Credential requires blob to be specified"))
|
_("Credential requires blob to be specified"))
|
||||||
|
|
||||||
|
@renames.renamed_kwarg('data', 'blob', version='1.7.0',
|
||||||
|
removal_version='2.0.0')
|
||||||
@utils.positional(1, enforcement=utils.positional.WARN)
|
@utils.positional(1, enforcement=utils.positional.WARN)
|
||||||
def create(self, user, type, blob=None, data=None, project=None, **kwargs):
|
def create(self, user, type, blob=None, data=None, project=None, **kwargs):
|
||||||
"""Create a credential
|
"""Create a credential
|
||||||
@@ -61,7 +63,8 @@ class CredentialManager(base.CrudManager):
|
|||||||
:type user: :class:`keystoneclient.v3.users.User` or str
|
:type user: :class:`keystoneclient.v3.users.User` or str
|
||||||
:param str type: credential type, should be either ``ec2`` or ``cert``
|
:param str type: credential type, should be either ``ec2`` or ``cert``
|
||||||
:param JSON blob: Credential data
|
:param JSON blob: Credential data
|
||||||
:param JSON data: Deprecated, use blob instead.
|
:param JSON data: Deprecated as of the 1.7.0 release in favor of blob
|
||||||
|
and may by removed in the 2.0.0 release.
|
||||||
:param project: Project, optional
|
:param project: Project, optional
|
||||||
:type project: :class:`keystoneclient.v3.projects.Project` or str
|
:type project: :class:`keystoneclient.v3.projects.Project` or str
|
||||||
:param kwargs: Extra attributes passed to create.
|
:param kwargs: Extra attributes passed to create.
|
||||||
@@ -94,6 +97,8 @@ class CredentialManager(base.CrudManager):
|
|||||||
"""
|
"""
|
||||||
return super(CredentialManager, self).list(**kwargs)
|
return super(CredentialManager, self).list(**kwargs)
|
||||||
|
|
||||||
|
@renames.renamed_kwarg('data', 'blob', version='1.7.0',
|
||||||
|
removal_version='2.0.0')
|
||||||
@utils.positional(2, enforcement=utils.positional.WARN)
|
@utils.positional(2, enforcement=utils.positional.WARN)
|
||||||
def update(self, credential, user, type=None, blob=None, data=None,
|
def update(self, credential, user, type=None, blob=None, data=None,
|
||||||
project=None, **kwargs):
|
project=None, **kwargs):
|
||||||
@@ -105,7 +110,8 @@ class CredentialManager(base.CrudManager):
|
|||||||
:type user: :class:`keystoneclient.v3.users.User` or str
|
:type user: :class:`keystoneclient.v3.users.User` or str
|
||||||
:param str type: credential type, should be either ``ec2`` or ``cert``
|
:param str type: credential type, should be either ``ec2`` or ``cert``
|
||||||
:param JSON blob: Credential data
|
:param JSON blob: Credential data
|
||||||
:param JSON data: Deprecated, use blob instead.
|
:param JSON data: Deprecated as of the 1.7.0 release in favor of blob
|
||||||
|
and may be removed in the 2.0.0 release.
|
||||||
:param project: Project
|
:param project: Project
|
||||||
:type project: :class:`keystoneclient.v3.projects.Project` or str
|
:type project: :class:`keystoneclient.v3.projects.Project` or str
|
||||||
:param kwargs: Extra attributes passed to create.
|
:param kwargs: Extra attributes passed to create.
|
||||||
|
Reference in New Issue
Block a user